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.