• 判断是手机端还是pc端


     1 <script type="text/javascript">
     2   if (window.location.toString().indexOf('pref=padindex') != -1) {
     3 
     4   } else {
     5     if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (
     6         /MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/
     7         .test(navigator.userAgent))) {
     8       if (window.location.href.indexOf("?mobile") < 0) {
     9         try {
    10           if (/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    11             window.location.href = "/m/index.php";
    12           } else if (/iPad/i.test(navigator.userAgent)) {} else {}
    13         } catch (e) {}
    14       }
    15     }
    16   }
    17 </script>
  • 相关阅读:
    es6类
    ES6模块化
    es6之常/变量
    es6之结构赋值
    es6之箭头函数、rest函数
    es6的新方法
    数组的使用方法
    Vue接口调用问题
    监听器和计算属性
    Vue路由
  • 原文地址:https://www.cnblogs.com/web-Knowledge/p/10825405.html
Copyright © 2020-2023  润新知