//get url parameter
function GetRequest() {
var url = location.search; //获取url中"?"符后的字串
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i < strs.length; i ++) {
theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
//launch client app
function launch_app() {
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { // 判断useragent,当前设备为ios设备
var loadDateTime = new Date(); // 设置时间阈值,在规定时间里面没有打开对应App的话,直接去App store进行下载。
window.setTimeout(function() {
var timeOutDateTime = new Date();
if (timeOutDateTime - loadDateTime < 5000) {
window.location = "weixin:";
} else {
window.close();
}
},
25);
window.location = "weixin:"; // ios端URL Schema
} else if (navigator.userAgent.match(/android/i)) { // 判断useragent,当前设备为andriod设备
window.open('http://weixin.qq.com/r/RHU6NQjE1japhxlWnyBg', 'newwindow', '');
} else {
// 判断useragent为桌面环境
//window.location= "http://www.baidu.com";
alert("Are You PC Browser ?!");
}
}
//browserRedirect();
function browserRedirect() {
if (navigator.userAgent.match(/(iPhone|iPod|iPad|android);?/i)) { // 判断useragent,当前设备为移动设备
//window.location.href = 'http://www.baidu.com';
alert("welcome");
} else {
// 判断useragent为桌面环境
// window.location.href= "http://www.sina.com";
alert("Are You PC Browser ?!");
}
}
手机终端设备启动微信app客户端的JS实现代码------利用JS获取url参数值
最新推荐文章于 2022-08-16 14:21:20 发布