zoukankan      html  css  js  c++  java
  • 判断是否为移动端

    function isMobile() {
                var userAgentInfo = navigator.userAgent;
                var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"];
                var mobile_flag = false;
                //根据userAgent判断是否是手机
                for (var v = 0; v < mobileAgents.length; v++) {
                    if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
                        mobile_flag = true;
                        break;
                    }
                }
                 var screen_width = window.screen.width;
                 var screen_height = window.screen.height;    
                 //根据屏幕分辨率判断是否是手机
                 if(screen_width < 500 && screen_height < 800){
                     mobile_flag = true;
                 }
                 return mobile_flag;
            }
  • 相关阅读:
    python
    python
    python
    python
    python
    python
    python
    python
    人生苦短,我用python,为什么选择python,python简介
    Mysql-查询
  • 原文地址:https://www.cnblogs.com/huanyun/p/12856222.html
Copyright © 2011-2022 走看看