var isMobile = {
Android: function () {
return (/android/i.test(navigator.userAgent.toLowerCase()));
},
BlackBerry: function () {
return (/blackberry/i.test(navigator.userAgent.toLowerCase()));
},
iOS: function () {
return (/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase()));
},
iPhone: function () {
return (/iphone/i.test(navigator.userAgent.toLowerCase()));
},
iPad: function () {
return (/ipad/i.test(navigator.userAgent.toLowerCase()));
},
iPod: function () {
return (/ipod/i.test(navigator.userAgent.toLowerCase()));
},
Opera: function () {
return (/opera mini/i.test(navigator.userAgent.toLowerCase()));
},
Windows: function () {
return (/iemobile/i.test(navigator.userAgent.toLowerCase()));
},
any: function () {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};

javascript Determine whether to move the client userAgent isMobile More articles about

  1. 《 How to use Javascript Judge the browser terminal device 》

    WEB How to develop through Javascript To determine that the terminal is PC.IOS(iphone).Android Well ? You can judge the browser's userAgent, Use regular to judge whether the mobile phone is ios and Android client . va ...

  2. JavaScript Judge the mobile terminal and pc End to end access to different websites

    JavaScript Judge the mobile terminal and pc End to end access to different websites Now many websites are divided into two versions , One pc A mobile terminal ( Except for responsive ), For both versions , You need to judge the device you are accessing , If it is pc, Direct access pc Website , ...

  3. How to use Javascript Judge the browser terminal device

    WEB How to develop through Javascript To determine that the terminal is PC.IOS(iphone).Android Well ? You can judge the browser's userAgent, Use regular to judge whether the mobile phone is ios and Android client var ...

  4. JavaScript Determine the browser type and version

    JavaScript It's the main language of front end development , We can write JavaScript Program to determine the type and version of the browser .JavaScript There are generally two ways to determine the type of browser , One is based on the unique properties of various browsers , The other ...

  5. Javascript Judge whether it is ipad Browser

    ipad It's using Safari Mobile browser , Access to the UA by : Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/5 ...

  6. ( turn )JavaScript Determine the browser type and version

    IE Only IE Support the creation of ActiveX Control , So she has something that other browsers don't have , Namely ActiveXObject function . Just judge window The object is ActiveXObject function , You can clearly judge that the current browser is ...

  7. Use javascript Judge browser type

    I've met in the project before that I want to do different things for different browsers js perhaps css operation , Later, a friend suddenly asked this question , therefore , Sort it out , Leave a note here , Convenient for future use . Use javascript Judge browser type : funct ...

  8. adopt JavaScript Determine the current browser version

    Copy it from someone else , It's only for your own learning . Reference from :http://www.cnblogs.com/leadzen/archive/2008/09/06/1285764.html JavaScript It's front-end development ...

  9. javascript Judge wechat browser

    original text :javascript Judge wechat browser use js There are two ways to determine whether the current environment is wechat's built-in browser : 1. Judge useragent 2. Some methods to judge whether it supports wechat built-in browser are supported , such as WeixinJSBri ...

Random recommendation

  1. CSS The exam questions

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. Seven common threshold segmentation codes (Otsu、 Maximum entropy 、 Iterative method 、 Adaptive threshold 、 Manual 、 Iterative method 、 Basic global threshold method )

    http://blog.csdn.net/xw20084898/article/details/17564957 One . Tools :VC+OpenCV Two . Language :C++ 3、 ... and . principle otsu Law ( Maximum inter class variance method , ...

  3. AngularJS In the use of Interceptors To deal with it in a unified way HTTP Error of (reproduce)

    original text :http://chensd.com/2016-03/Angular-Handle-Global-Http-Error-with-Interceptors.html?utm_source=tuic ...

  4. O(1) Time to delete the known nodes of the linked list

    This problem doesn't need to traverse from the first node to the known node , Just know the known nodes , Assign the next node to it , Just delete the next node , There are also various situations to consider . 1) The linked list is empty or the known node is empty 2) A linked list has only one node , This node is ...

  5. Linux Everywhere

    Linux is Everywhere From the government . education . Business and non-profit organizations . Several aspects of scientific research institutions show where they are used now Linux.

  6. about c++ And java Analysis and solution of China's garbage problem

    about c++ And java Analysis and solution of China's garbage problem DionysosLai([email protected])  2014/8/1 Problem analysis : The reason for the Chinese garbled problem , In the final analysis, Chinese coding and English coding ...

  7. android Intent Detailed explanation of mechanism

    http://www.oschina.net/question/565065_67909 http://www.cnblogs.com/hummersofdie/archive/2011/02/12/ ...

  8. [NOIP2002] String transformation T2 two-way BFS

    Title Description There are two known strings   A,B  And a set of rules for string transformation ( at most 6 A rule ): A1−>B1 A2−>B2 The meaning of the rule is : stay   A$ The substring in   A1 Can be transformed into can be transformed into B1.A2 Can be transformed into ...

  9. IIS Starting the application pool reports an error &quot; The service cannot accept control information at this time &quot;

    Open the command line as an administrator Enter the command netsh winsock reset The explanation of this command in the encyclopedia is netsh winsock reset command , The function is to reset Winsock Catalog . If... On a machine Wins ...

  10. duilib Chinese font font Set up

    <Font name=" Microsoft YaHei " size="9" bold="false"/> <Label name="n ...