zoukankan      html  css  js  c++  java
  • js判断设备(转)

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>js判断设备类型是移动设备还是PC设备</title>
      <script type="text/javascript">
        // borwserRedirect
        (function browserRedirect(){
          var sUserAgent = navigator.userAgent.toLowerCase();
          var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
          var bIsIphone = 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) == 'web';
          var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
          var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile';
    
          if(bIsIpad || bIsIphone || bIsMidp || bIsUc7 || bIsUc || bIsCE || bIsWM){
            window.location.href = 'http://www.163.com/';
          }else{
            window.location.href = 'http://www.baidu.com/';
          }
        })();
      </script>
    </head>
    <body>
      <h1>pc浏览</h1>
    </body>
    </html>
  • 相关阅读:
    mongoDB安装配置
    linux-批量修改目录下后缀shell
    备份mysql的shell
    mysql_DML_索引、视图
    mysql_存储过程
    mysql_备份_mysqldump
    mysql_DCL_grant/revoke
    mysql_DML_select_子查询
    mysql_DML_select_union
    mysql_DML_select_聚合join
  • 原文地址:https://www.cnblogs.com/limit1/p/4688288.html
Copyright © 2011-2022 走看看