<script language= "JavaScript" type= "Text/javascript" >varBrowser ={versions:function () { varU = navigator.useragent, app =navigator.appversion; return{//Mobile Terminal browser version informationTrident:u.indexof (' Trident ') >-1,//IE kernelPresto:u.indexof (' presto ') >-1,//Opera KernelWebkit:u.indexof (' AppleWebKit ') >-1,//Apple, Google kernelGecko:u.indexof (' Gecko ') >-1 && u.indexof (' khtml ') = =-1,//Firefox kernelMobile:!! U.match (/applewebkit.*mobile.*/) | | !! U.match (/applewebkit/),//whether it is a mobile terminalIos:!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/),//iOS terminalAndroid:u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1,//Android Terminal or UC browserIphone:u.indexof (' IPhone ') >-1 | | U.indexof (' Mac ') >-1,//whether it's an iphone or Qqhd browserIpad:u.indexof (' IPad ') >-1,//whether ipadWebapp:u.indexof (' Safari ') = =-1//whether the web should program, no head with the 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 ("Is the iphone:" +Browser.versions.iPhone); Document.writeln ("Whether ipad:" +Browser.versions.iPad); Document.writeln (navigator.useragent);</script>
//Another type of://the implementation functions are as followsfunctionGetbrowser (n) {varUA =Navigator.userAgent.toLowerCase (), S, name= ' ', ver= 0; //Probe Browser(s = Ua.match (/msie ([\d.] +)/)) ? _set ("ie", _tofixedversion (s[1]): (S= Ua.match (/firefox\/([\d.] +)/)) ? _set ("Firefox", _tofixedversion (s[1]): (S= Ua.match (/chrome\/([\d.] +)/)) ? _set ("Chrome", _tofixedversion (s[1]): (S= Ua.match (/opera. ( [\d.] +)/)) ? _set ("Opera", _tofixedversion (s[1]): (S= Ua.match (/version\/([\d.] +). *safari/))? _set ("Safari", _tofixedversion (s[1)): 0; function_tofixedversion (ver, floatlength) {ver= (' + ver '). Replace (/_/g, '. ')); Floatlength= Floatlength | | 1; Ver= String (ver). Split ('. ')); Ver= ver[0] + '. ' + (Ver[1] | | ' 0 '); Ver=Number (ver). toFixed (Floatlength); returnver; } function_set (bname, bver) {name=bname; Ver=Bver; } return(n = = ' n '? Name: (n = = ' V '? Ver:name +ver));}; When called,varNeihe = Getbrowser ("n"); What you get is the kernel used by the browser. When calledvarBanben = Getbrowser ("V"); What you get is the version number of the browser. When calledvarBrowser = Getbrowser (); What you get is the browser kernel plus the version number.
JS Get browser kernel