当前位置 : 主页 > 网络编程 > JavaScript >

判断手机是否有app,没有打开下载地址

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { window.location.href = "com.baidu.tieba://";//ios app协议 window.setTimeout(function () { window.location.href = "https://itunes.apple.com/cn/app/id477927812"; }, 200
gistfile1.txt
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
                                    window.location.href = "com.baidu.tieba://";//ios app协议
                                    window.setTimeout(function () {
                                        window.location.href = "https://itunes.apple.com/cn/app/id477927812";
                                    }, 2000)
                                } else if (navigator.userAgent.match(/android/i)) {
                                    window.location.href = "com.baidu.tieba://app";//android app协议
                                    window.setTimeout(function () {
                                        window.location.href = "https://****.apk";//android 下载地址
                                    }, 2000)
                                }
网友评论