web页面中打开App
2017-02-17 本文已影响0人
野薇薇
逻辑: 默认手机中有你所要打开的APP,直接跳转至与APP同事约定的URL,如果间隔某个时间段没有打开就说明未安装某应用,链接至其下载页面
var loadDateTime = new Date();
//ios中
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
window.setTimeout(function() {
var timeOutDateTime = new Date();
if (timeOutDateTime - loadDateTime < 5000) {
window.location = "APP的下载页面";
} else {
window.close();
}
},
2500);
window.location = "与IOS同事约定的协议"; //例如:xiaomiapp://
}else if(安卓){
//安卓类似
}
萌鑫儿