0
点赞
收藏
分享

微信扫一扫

自动判断是否是手机端浏览还是电脑…


   function IsPC() {

           var userAgentInfo = navigator.userAgent;

           console.log(navigator.userAgent);

           var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");

           var flag = true;

           for (var v = 0; v < Agents.length; v++) {

               if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }

           }

           return flag;

       }


       if (IsPC()) {

           console.log("isPc");

           window.location = "http://www.hjclass.com/classzt/MKTTopic_474"+location.search;

       } else {

           console.log("isMobile");

       }


     

举报

相关推荐

0 条评论