JS 判断iPad, Android, iPhone, iPod, MI PAD实现页面跳转

180it 2021-06-05 AM 60℃ 0条
<script type="text/javascript" src="//11.mydrivers.com/2018/news/jquery-1.7.2.min.js"></script>
<script>
        function MTiaoZhuan() {
            var ua = window.navigator.userAgent;
            var s_ref;
            try {
                s_ref = escape(document.referrer);
            }
            catch (ex)
            { }
            var href = "/m/?ref=" + s_ref;
            var config = ['iPad', 'Android', 'iPhone', 'iPod', 'MI PAD'];
            var isPc = true;
            for (var i = 0; i < config.length; i++) {
                if (ua.indexOf(config[i]) !== -1) {
                    isPc = false;
                    break;
                }
            }
            if (isPc === false) {
                window.location.href = href;
            }
        }

        MTiaoZhuan();
    </script>
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

JS 判断iPad, Android, iPhone, iPod, MI PAD实现页面跳转