client browser judgment (ios. Android)

Source: Internet
Author: User
<span id="Label3"></p><p><p>In the development project, we may need to determine the client browser version of the corresponding processing, usually through the browser useragent to determine the browser version, so in this summary, convenient for later Use.</p></p><p><p>  </p></p><pre><script type= "text/javascript" ><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Judging the access terminal</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">var</span></span>Browser=<span style="color: #000000;"><span style="color: #000000;">{versions:</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">function</span></span><span style="color: #000000;"><span style="color: #000000;">(){ </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">var</span></span>U = navigator.useragent, app =<span style="color: #000000;"><span style="color: #000000;">navigator.appversion; </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">{trident:u.indexof (</span></span>' Trident ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">IE kernel</span></span>Presto:u.indexof (' Presto ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Opera Kernel</span></span>Webkit:u.indexof (' AppleWebKit ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">apple, Google kernel</span></span>Gecko:u.indexof (' Gecko ') >-1 && u.indexof (' khtml ') = =-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Firefox kernel</span></span>mobile:!! U.match (/applewebkit.*mobile.*/),<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">whether it is a mobile terminal</span></span>Ios:!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/),<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">iOS terminal</span></span>Android:u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Android Terminal or UC browser</span></span>Iphone:u.indexof (' iPhone ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">whether it's an iphone or Qqhd browser</span></span>Ipad:u.indexof (' IPad ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">whether ipad</span></span>Ipod:u.indexof (' iPod ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">whether the ipod</span></span>Webapp:u.indexof (' Safari ') = =-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">whether the web should program, no head with the bottom</span></span>Weixin:u.indexof (' Micromessenger ') >-1,<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">is</span></span>Qq:u.match (/\sqq/i) = = "qq"<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">whether QQ</span></span><span style="color: #000000;"><span style="color: #000000;"> }; } (), language: (navigator.browserlanguage</span></span>||<span style="color: #000000;"><span style="color: #000000;">navigator.language). tolowercase ()}</span></span></script></pre><p><p></p></p><p><p>client browser judgment (ios. Android)</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.