H5打开App应用市场

2022-08-26  本文已影响0人  Hasan_hs
<!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>

上一篇下一篇

猜你喜欢

热点阅读