运营者的网络红宝书

JS移动端PC端判断

2019-07-05 14:57栏目:环境判断
TAG:

移动端PC端判断

   <script>
      var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
            if (is_mobi) {
                window.location.href = "手机端";
      }else{
                window.location.href = "PC端";

      }
    </script>