美文网首页
web页面中打开App

web页面中打开App

作者: 野薇薇 | 来源:发表于2017-02-17 14:31 被阅读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(安卓){
//安卓类似
}
萌鑫儿

相关文章

网友评论

      本文标题:web页面中打开App

      本文链接:https://www.haomeiwen.com/subject/mjxlwttx.html