js判断请求是android还是ios,并判断手机是否存在一个特定的程序,如果存在就打开,不存在就下载
来源:互联网 发布:黑搜对淘宝号有影响吗 编辑:程序博客网 时间:2024/04/30 05:25
window.userAgentPlatform = 'PC';
window.referSite = '';
window.appProtocolLink = "";
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return "";
}
/**��ȡurl�ö��ַ����ַ�**/
function GetParam(paramName) {
paramValue = "";
isFound = false;
if (this.location.search.indexOf("?") == 0
&& this.location.search.indexOf("=") > 1) {
arrSource = unescape(this.location.search).substring(1,
this.location.search.length).split("&");
i = 0;
while (i < arrSource.length && !isFound) {
if (arrSource[i].indexOf("=") > 0) {
if (arrSource[i].split("=")[0].toLowerCase() == paramName
.toLowerCase()) {
paramValue = arrSource[i].split("=")[1];
isFound = true;
}
}
i++;
}
}
return paramValue;
}
// ���referSite�ж���Դ�������ţ�
// ���isappinstalled��ֵ�ж���ת�����ҳ��
function initFunc() {
var divc = document.getElementById('guide');
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
divc.setAttribute("class", "sinaweiboiPhone");
userAgentPlatform = 'iPhone';
} else {
divc.setAttribute("class", "sinaweiboAndroid");
userAgentPlatform = 'Android';
}
var thisURL = document.URL;
var id = GetParam("id");
var isappinstalled = getQueryString("isappinstall");
if (isappinstalled == '1') {
if (userAgentPlatform == "iPhone") {
setTimeout(function() {
window.location = "=" + id;
}, 2000);
} else if (userAgentPlatform == "Android") {
setTimeout(function() {
window.location = "?id="+id;
}, 200);
}
}/*else if(isappinstalled == '0'){
} */else {
if(!navigator.userAgent.match(/(MicroMessenger);?/i))
{
if (userAgentPlatform == "iPhone")
{
document.location.href = "plist地址";
}
else if (userAgentPlatform == "Android")
{
document.location.href = "软件地址";
}
}
}
}
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", initFunc, false);
} else {
window.onload = initFunc;
}
- js判断请求是android还是ios,并判断手机是否存在一个特定的程序,如果存在就打开,不存在就下载
- 如何判断一个已知的表中是否存在某个字段,如果不存在就创建它.
- 如何判断一个已知的表中是否存在某个字段,如果不存在就创建它.
- Js判断移动端是否存在客户端:如果存在则打开,如果不存在则下载
- 用js方法判断某个js方法是否存在,如果存在就执行的实现
- 判断窗体是否存在,如果存在就激活
- 判断窗体是否存在,如果存在就激活
- ORACLE 判断触发器是否存在,如果存在就删除
- ORACLE 判断表是否存在,如果存在就删除
- ORACLE 判断序列是否存在,如果存在就删除
- 判断本地系统目录下是否存在XML文件,如果不存在就创建一个XMl文件,若存在就在里面执行添加数据
- iphone 判断文件是否存在,如果不存在就从Bundle里面读取
- 检查一个文件夹是否存在,如果不存在就创建它
- 判断XML文件是否存在,不存在就创建一个XMl文件,存在就在里面添加一条数据
- 通过文件锁实现,程序开始运行时,先判断文件是否存在,若存在则表明该程序已经在运行了,如果不存在就用open函数创建该文件,程序退出时关闭文件并删除文件
- Java判断文件夹是否存在,不存在就创建
- Java 判断多级路径是否存在,不存在就创建
- C#判断指定目录是否存在,不存在就创建
- HDU 1394 Minimum Inversion Number (最小逆序对数&线段树)
- Python 数据处理相关内容记录
- group by...having....理解
- Android中dip、dp、sp、pt和px的区别
- 新建raw data 分区
- js判断请求是android还是ios,并判断手机是否存在一个特定的程序,如果存在就打开,不存在就下载
- C#结合天敏VC4000采集卡视频监控
- C++设计模式之一 工厂模式(简单工厂、工厂和抽象工厂)
- 最长连续回文串(Longest Palindromic Substring)
- Java中用ClassLoader载入各种资源(类、文件、web资源)的方法
- CMake Error: Could not create named generator Visual Studio 11
- [JAVA] WEB开发中显示图片的问题
- Android获取屏幕分辨率及DisplayMetrics简介
- OpenCV小试牛刀1——OPENCV宏