Determine the mobile terminal browser version based on javascript.

Source: Internet
Author: User

Determine the mobile terminal browser version based on javascript.

The specific explanations are in comments, so there is not much nonsense here, and the code is provided directly.

Copy codeThe Code is as follows:
<Script type = "text/javascript">
/*
* Smartphone browser version information:
*
*/
Varbrowser = {
Versions: function (){
Varu = navigator. userAgent, app = navigator. appVersion;
Return {// mobile terminal browser version information
Trident: u. indexOf ('think')>-1, // IE Kernel
Presto: u. indexOf ('presto ')>-1, // opera Kernel
WebKit: u. indexOf ('applewebkit')>-1, // Apple, Google Kernel
Gecko: u. indexOf ('gecko ')>-1 & u. indexOf ('k') =-1, // Firefox Kernel
Mobile :!! U. match (/AppleWebKit. * Mobile. */) | !! U. match (/AppleWebKit/), // whether it is a mobile terminal
Ios :!! U. match (/\ (I [^;] +; (U ;)? CPU. + Mac OS X/), // ios Terminal
Android: u. indexOf ('android')>-1 | u. indexOf ('linux ')>-1, // Android terminal or uc Browser
IPhone: u. indexOf ('iphone ')>-1 | u. indexOf ('mac')>-1, // whether the browser is iPhone or QQHD
IPad: u. indexOf ('ipad ')>-1, // whether iPad
WebApp: u. indexOf ('safari ') =-1 // whether the web should be a program with no header or bottom
};
}(),
Language :( navigator. browserLanguage | navigator. language). toLowerCase ()
}
Document. writeln ("language version:" + browser. language );
Document. writeln ("whether it is a mobile terminal:" + browser. versions. mobile );
Document. writeln ("ios terminal:" + browser. versions. ios );
Document. writeln ("android terminal:" + browser. versions. android );
Document. writeln ("iPhone:" + browser. versions. iPhone );
Document. writeln ("iPad:" + browser. versions. iPad );
Document. writeln (navigator. userAgent );
 
</Script>

The browser versions of common mobile terminals are basically here. For more information, see.

Related Article

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.