The specific explanations are all in the comments, so I won't talk much nonsense here, just present the code
The code copy is as follows:
<script type="text/javascript">
/*
* Smart browser version information:
*
*/
varbrowser={
versions:function(){
varu = navigator.userAgent, app = navigator.appVersion;
return{//Mobile terminal browser version information
trident: u.indexOf('Trident') > -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('KHTML') == -1, //Firefox kernel
mobile: !!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/), // Is it 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, //Is it an iPhone or QQHD browser
iPad: u.indexOf('iPad') > -1,//Is it iPad
webApp: u.indexOf('Safari') == -1//Is the web supposed to program, no header or bottom
};
}(),
language:(navigator.browserLanguage || navigator.language).toLowerCase()
}
document.writeln("Language: "+browser.language);
document.writeln(" is a mobile terminal: "+browser.versions.mobile);
document.writeln(" ios terminal: "+browser.versions.ios);
document.writeln(" android terminal: "+browser.versions.android);
document.writeln(" is an iPhone: "+browser.versions.iPhone);
document.writeln(" Whether iPad: "+browser.versions.iPad);
document.writeln(navigator.userAgent);
</script>
The browser versions of common mobile terminals are basically here. Please refer to them if you need them.