美文网首页
判断安卓还是苹果(微信支付宝浏览器)下载APP

判断安卓还是苹果(微信支付宝浏览器)下载APP

作者: blank的小粉er | 来源:发表于2018-06-13 11:13 被阅读0次

1.苹果手机在微信支付宝内置浏览器打开能都直接跳转到appstroe去下载应用
2.安卓手机在微信支付宝内置浏览器打开不能直接下载,需弹出浮层指导用户通过浏览器打开

 downApp() {
            let ua = navigator.userAgent.toLowerCase();
            let userAgent = navigator.userAgent.toLowerCase();
            //android终端
            let isAndroid =
                ua.indexOf("Android") > -1 || ua.indexOf("Adr") > -1; //ios终端
            let isiOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
            if (isWeixinBrowser()) {
                if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    window.location =
                        "https://itunes.apple.com/cn/app/id1361038837";
           
                } else if (/(Android)/i.test(navigator.userAgent)) {         
                    this.showWx = true;
                }
            } else if (userAgent.match(/Alipay/i) == "alipay") {
                if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    window.location =
                        "https://itunes.apple.com/cn/app/id1361038837";

                 
                } else if (/(Android)/i.test(navigator.userAgent)) {
                    //android
                    this.showWx = true;
                }
            } else {
                if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    //ios
                    // this.ShowPop = !this.ShowPop;
                    // this.ShowDark = !this.ShowDark;
                    window.location =
                        "https://itunes.apple.com/cn/app/id1361038837";

                    // alert("ios")
                } else if (/(Android)/i.test(navigator.userAgent)) {
                    //android
                    window.location =
                        "http://pda.aixuepai.com.cn:9998/apk/amapp-ali.apk";
                }
            }

            function isWeixinBrowser() {
                return /micromessenger/.test(ua) ? true : false;
            }
        }

相关文章

网友评论

      本文标题:判断安卓还是苹果(微信支付宝浏览器)下载APP

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