js调用app启动页

时间:2023-03-08 21:52:24

第一步:添加js

$(function () {
var ua = window.navigator.userAgent.toLowerCase();
//微信
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
     //微信浏览器绑定事件
/*$(".app").bind('click', function (event) {
window.location.href = '';
})*/
}else{//非微信浏览器
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { //iPhone|iPod|iPad浏览器
            $(".app").bind('click', function (event) {
var loadDateTime = new Date();
window.setTimeout(function () {
var timeOutDateTime = new Date();
if (timeOutDateTime - loadDateTime < 5000) {
window.location = "http://itunes.apple.com/app/1219885292";//ios下载页面
} else {
window.close();
}
}, 25);
window.location = "YuWan://com.YuWan.DianJingPingTai"; //调用ios启动页地址
})
}else if (navigator.userAgent.match(/android/i)) { //安卓浏览器
$(".app").bind('click', function (event) {
var state = null;
try {
window.location = 'appshare://bluemobi.cn.esport'; //调用andriod启动页地址
                    setTimeout(function(){
window.location= "download.html"; //android下载页面 },500);
} catch(e) {}
})
} }
})

第二步:请andriod人员配置一下参数 apps custom url schemes

http://blog.****.net/xc765926174/article/details/51397847

第三步:请ios人员配置一下参数apps custom url schemes

http://blog.****.net/ba_jie/article/details/6884818