zoukankan      html  css  js  c++  java
  • 不同设备(ipad、iphone、PC、android、androidpad)访问同一页面跳转

    <html>
    <head>
    <title>
    不同设备跳转
    </title>
     <script type="text/javascript">   
        window.onload=function(){
            var sUserAgent = navigator.userAgent.toLowerCase(); 
            var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";  
            var bIsIphoneOs = sUserAgent.match(/iphone/i) == "iphone";  
            var bIsAndroid = ((sUserAgent.match(/android/i) == "android")&&(sUserAgent.match(/build/i) == null))||(sUserAgent.match(/mi/i)=="mi")||(sUserAgent.match(/x11/i)=="x11");
            var bIsAndroidpad = (sUserAgent.match(/android/i) == "android")&&(sUserAgent.match(/build/i) == "build")&&(sUserAgent.match(/mi/i)==null);;         
            if (bIsIpad) 
            {  
                window.location.href="http://www.baidu.com";
                 
            } 
            else if(bIsIphoneOs) {  
                window.location.href="http://www.tianya.cn";
        
            }
            else if(bIsAndroid) {  
                window.location.href="http://www.pengyou.com";
    
            }
            else if(bIsAndroidpad) {  
                window.location.href="http://www.hao123.com";
     
            } 
        }
    
     </script>
    </head>
    
    <body>
     不同设备跳转说
    </body>
    </html>
  • 相关阅读:
    Container(容器)
    version ctrl
    url和uri的区别
    Injector
    build tool
    变量
    python中break和continue的区别
    同步代码块以及同步方法之间的区别以及联系
    写在前面
    WebService入门
  • 原文地址:https://www.cnblogs.com/luojie/p/3118649.html
Copyright © 2011-2022 走看看