//判断是否下载APP


if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
var loadDateTime = new Date();
window.setTimeout(function() {
var timeOutDateTime = new Date();
if (timeOutDateTime - loadDateTime < 5000) {
window.location = "要跳转的页面URL";
} else {
window.close();
}
},
25);
window.location = " apps custom url schemes ";
} else if (navigator.userAgent.match(/android/i)) {
var state = null;
try {
state = window.open("apps custom url schemes ", '_blank');
} catch(e) {}
if (state) {
window.close();
} else {
window.location = "要跳转的页面URL";
}
}
//2
if(isAndroid){
function android(){
window.location.href = "openwjtr://com.tyrbl.wjtr"; /***打开app的协议,有安卓同事提供***/
window.setTimeout(function(){
window.location.href = "http://www.wjtr.com/download/index.html"; /***打开app的协议,有安卓同事提供***/
},2000);
};
if(isiOS){
function ios(){
var ifr = document.createElement("iframe");
ifr.src = "openwjtr://com.tyrbl.wjtr"; /***打开app的协议,有ios同事提供***/
ifr.style.display = "none";
document.body.appendChild(ifr);
window.setTimeout(function(){
document.body.removeChild(ifr);
window.location.href = "http://www.wjtr.com/download/index.html"; /***下载app的地址***/
},2000)
};
}

posted @ 2016-11-28 19:50  <张磊>  阅读(201)  评论(0编辑  收藏  举报