威尼斯赌博游戏

使用Jquery判断是电脑或手机和微信浏览器访问

来源: www.zngps.com| 2017-12-08 21:52
<script type = "text/javascript" language = "javascript" >
             //平台、设备和操作系统 
             var system = {
                 win: false,
                 mac: false,
                 xll: false,
                 ipad: false
             };
             //检测平台 
             var p = navigator.platform;
             system.win = p.indexOf("Win") == 0;
             system.mac = p.indexOf("Mac") == 0;
             system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
             system.ipad = (navigator.userAgent.match(/iPad/i) != null) ? true : false;
             //跳转语句,如果是手机访问就自动跳转到wap.baidu.com页面 
             if (system.win || system.mac || system.xll || system.ipad) {
                 alert("PC");
             } else {
                 
                 var ua = navigator.userAgent.toLowerCase();  
                 if(ua.match(/MicroMessenger/i)=="micromessenger") {  
                     alert("微信浏览器");
                 } else {  
                     alert("手机");
                 }  
                 //window.location.href = "http://www.jdpatro.com/3g/";
             }
     </script>

猜你喜欢
推荐
随机推荐
相关文档
Top
Baidu