一个页面进去自动跳到指定的页面去

<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>index</title>
        <script>
            var  website ='https://www.baidu.com/', mobileWebSite ='https://www.baidu.com/', sows = 'true';
        </script>
        <script >
            if(sows =='true'){
                var juesha_pc_domain = website;
                var juesha_wap_domain = mobileWebSite;
                if(website!='' && mobileWebSite!= ''){
                    function browserRedirect() {
                        var sUserAgent= navigator.userAgent.toLowerCase();
                        var bIsIpad= sUserAgent.match(/ipad/i) == "ipad";
                        var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os";
                        var bIsMidp= sUserAgent.match(/midp/i) == "midp";
                        var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
                        var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb";
                        var bIsAndroid= sUserAgent.match(/android/i) == "android";
                        var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce";
                        var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile";
                        if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
                            if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
                                window.location.href= juesha_wap_domain;
                            } else{
                                document.writeln("<frameset><frame src="+juesha_wap_domain+" /></frameset>");
                            }
                        } else {
                            document.writeln("<frameset><frame src="+juesha_pc_domain+" /></frameset>");
                        }
                    }
                    browserRedirect();
                }
            }
        </script>
    <style>
        #content_news p {
            line-height: 25px;
            font-size: 14px;
            text-align: justify;
        }
        .line-middle img {
            max-width: 100%;
            margin: 0 auto;
            display: block;
        }
    </style>
</head>
<body>
    我是一个页面
</body>
</html>

其中 website 是指pc端跳转页面 mobileWebSite 手机端跳转页面

    原文作者:木木先生
    原文地址: https://segmentfault.com/a/1190000019699309
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞