美文网首页
H5打开App应用市场

H5打开App应用市场

作者: Hasan_hs | 来源:发表于2022-08-26 16:28 被阅读0次
<!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>

相关文章

网友评论

      本文标题:H5打开App应用市场

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