APP下載頁二維碼支援識別微信

龐順龍發表於2019-05-10


<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>APP下載</title>
    <script src="download/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script language="javascript">
        window.onload = function() { 
                var u = navigator.userAgent;
                if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {
                    //安卓手機 
                    window.location.href = "https://app.xxx.xxx.cn/download/xxx.6.0.0.0103.68667-scu.apk";
                } else if (u.indexOf('iPhone') > -1) {
                    //蘋果手機 
                    alert('蘋果商店正在稽核中,請稍後重試。');
                    // window.location.href = "https://itunes.apple.com/us/app/xxx?l=zh&ls=1&mt=8";
                } else if (u.indexOf('Windows Phone') > -1) { 
                    //winphone手機
                    alert("WindowsPhone暫未推出。"); 
                } else if (u.indexOf('Windows NT') > -1) {
                    //Windows電腦
                    alert("請用手機瀏覽器訪問。"); 
                } 
            }
            $(window).on("load", function() {
                var winHeight = $(window).height();
                function is_weixin() {
                    var ua = navigator.userAgent.toLowerCase();
                    if (ua.match(/MicroMessenger/i) == "micromessenger") {
                        return true;
                    } else {
                        return false;
                    }
                }
                var isWeixin = is_weixin();
                if (isWeixin) {
                    $(".weixin-tip").css("height", winHeight);
                    $(".weixin-tip").show();
                }
            })
        </script>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        a {
            text-decoration: none;
        }

        img {
            max-width: 100%;
            height: auto;
        }

        .weixin-tip {
            display: none;
            position: fixed;
            left: 0;
            top: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.8);
            filter: alpha(opacity=80);
            height: 100%;
            width: 100%;
            z-index: 100;
        }

        .weixin-tip p {
            text-align: center;
            margin-top: 10%;
            padding: 0 5%;
        }
    </style>
</head>

<body>
    <div class="weixin-tip">
        <p>
            <img src="download/live_weixin.png" alt="微信開啟" />
        </p>
    </div>
</body>

</html>

微信掃一掃效果:


請喊我大龍哥最後編輯於:4個月前

內容均為作者獨立觀點,不代表八零IT人立場,如涉及侵權,請及時告知。

相關文章