H5打开App应用市场

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>App下载</title>
    </head>
    <body>
        <script type="text/javascript">
            function judgeBrand(sUserAgent) {
                console.log(sUserAgent)
                var isIphone = sUserAgent.match(/iphone/i) == "iphone";
                var isHuawei = sUserAgent.match(/huawei/i) == "huawei";
                var isHuaweis = sUserAgent.match(/HUAWEI/i) == "HUAWEI";
                var isHonor = sUserAgent.match(/honor/i) == "honor";
                var isOppo = sUserAgent.match(/oppo/i) == "oppo";
                var isOppoR15 = sUserAgent.match(/pacm00/i) == "pacm00";
                var isVivo = sUserAgent.match(/vivo/i) == "vivo";
                var isXiaomi = sUserAgent.match(/mi\s/i) == "mi ";
                var isXiaomi2s = sUserAgent.match(/mix\s/i) == "mix ";
                var isRedmi = sUserAgent.match(/redmi/i) == "redmi";
                var isSamsung = sUserAgent.match(/sm-/i) == "sm-";

                if (isIphone) {
                    location.href = "https://****"//苹果应用市场
                } else if (isHuawei || isHonor || isHuaweis) {
                    location.href = "https://****"//华为应用市场
                } else if (isOppo || isOppoR15) {
                    location.href = "https://****"//oppo应用市场
                } else if (isVivo) {
                    location.href = "https://****"//Vivo应用市场
                } else if (isXiaomi || isRedmi || isXiaomi2s) {
                    location.href = "https://****"//Xiaomi应用市场
                } else if (isSamsung) {
                    location.href = "https://****"//Samsung应用市场
                } else {
                    location.href = "https://****"//
                }
            }
            judgeBrand(navigator.userAgent.toLowerCase());
        </script>
    </body>
</html>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容