Simulate WeChat scanning short connection redirection, but the QQ display result is different from WeChat?

24 Views Asked by At

I used my iOS phone WeChat to scan the code correctly, but when I scanned the code on QQ, a second pop-up window popped up before I could wait for the first one to confirm? But on Android, WeChat and QQ are both executed normally! At first, I thought there was an issue with the QQ browser kernel, but after simulating it in QQ browser, it was still normal [PASS] 2. After research and discussion, it was initially believed that the issue was the interception of iOS's QQ internal browser [Attached below are the QR code, source code, and warehouse address! I hope everyone can correct me and answer my questions!]

 <script type="text/javascript">
        // 获取终端的相关信息
        var Terminal = {
            // 辨别移动终端类型
            platform : function(){
                var u = navigator.userAgent, app = navigator.appVersion;
                return {
                    trident: u.indexOf('Trident') > -1, //IE内核
                    presto: u.indexOf('Presto') > -1, //opera内核
                    webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                    gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
                    mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                    ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                    // android终端或者uc浏览器
                    android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 || u.indexOf('Adr') > -1,
                    // 是否为iPhone或者QQHD浏览器
                    iPhone: u.indexOf('iPhone') > -1 ,
                    // 是否iPad
                    iPad: u.indexOf('iPad') > -1,
                    webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
                    weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
                    qq: u.match(/\sQQ/i) == " qq" //是否QQ
                };
            }(),
            // 辨别移动终端的语言:zh-cn、en-us、ko-kr、ja-jp...
            language : (navigator.browserLanguage || navigator.language).toLowerCase()
        }
        const Doc = document.querySelector('#demo');
        const sleep = () => {
            return new Promise(resolve => {
                setTimeout(()=>{
                    alert('...判断中');
                    Doc.textContent = '判断中';
                    setTimeout(()=>{
                        resolve()
                    },1000)
                }, 1000)
            });
        }

        sleep().then(() => {
            // 根据不同的终端,跳转到不同的地址
            if(Terminal.platform.android){
                theUrl = 'ztxAndroid APP对应下载地址:apk文件地址';
                alert(theUrl)
                Doc.textContent = 'ztxAndroid';
            }else if(Terminal.platform.iPhone){
                theUrl = 'ztxiPhone APP对应下载地址:APP Store地址';
                alert(theUrl)
                Doc.textContent = 'ztxiPhone';
            }
        })
    </script>

Warehouse Address QR code image

  1. Detection on Android and iOS real machines
  2. Simulation detection of commonly used browsers I am wondering if the reason for this issue is due to the built-in QQ browser in iOS (because scanning the code opens the QQ built-in browser)
0

There are 0 best solutions below