1. js Method/*judging the browser name and version can only be judged: ie/firefox/chrome/opera/safari2012 May 16 23:47:08 browser kernel ua:ua; browser kernel name: nv.name; browser kernel version: nv.version; browser shell name: Nv.shell;*/varNV = {};varUA =navigator.userAgent.toLowerCase ();Try{nv.name=!-[1,]? ' ie:(Ua.indexof ("Firefox") >0)? ' Firefox:(Ua.indexof ("Chrome") >0)? ' Chrome: Window.opera?‘ Opera: Window.opendatabase?‘ Safari:' Unkonw ';}Catch(e) {};Try{nv.version= (nv.name== ' IE ')? Ua.match (/msie ([\d.] +)/) [1]:(Nv.name= = ' Firefox ')? Ua.match (/firefox\/([\d.] +)/) [1]:(Nv.name= = ' Chrome ')? Ua.match (/chrome\/([\d.] +)/) [1]:(Nv.name= = ' opera ')? Ua.match (/opera. ( [\d.] +)/) [1]:(Nv.name= = ' Safari ')? Ua.match (/version\/([\d.] +)/) [1]:' 0 ';}Catch(e) {};Try{Nv.shell= (Ua.indexof (' 360ee ') >-1)? ' 360 Speed Browser ':(Ua.indexof (' 360SE ') >-1)? ' 360 Secure Browser ':(Ua.indexof (' SE ') >-1)? ' Sogou Browser ':(Ua.indexof (' Aoyou ') >-1)? ' Surfing the browser ':(Ua.indexof (' TheWorld ') >-1)? ' window of the World browser ':(Ua.indexof (' Worldchrome ') >-1)? ' window of the World Speed Browser ':(Ua.indexof (' Greenbrowser ') >-1)? ' Green Browser ':(Ua.indexof (' Qqbrowser ') >-1)? ' QQ Browser ':(Ua.indexof (' Baidu ') >-1)? ' Baidu Browser ':' Unknown or no shell ';}Catch(e) {}alert (' Browser ua= ' +ua+ ' \ n \ nthe browser name = ' +nv.name+ ' \ n ' browser version = ' +parseint (nv.version) + ' \ n ' Browser shell = ' +Nv.shell);});2. jquery plugin; (function($){/*judging the browser name and version can only be judged: ie/firefox/chrome/opera/safari2012 May 16 23:47:08 The browser kernel is ua:$. NV (' UA '), or $. NV (' UA '); browser kernel name: $. NV (' name '), or $. NV (); browser kernel version: $. NV (' version '); browser shell name: $. NV (' shell ');*/$.extend ({NV:function(name) {varNV = {};varUA =navigator.userAgent.toLowerCase ();Try{nv.name=!-[1,]? ' ie:(Ua.indexof ("Firefox") >0)? ' Firefox:(Ua.indexof ("Chrome") >0)? ' Chrome: Window.opera?‘ Opera: Window.opendatabase?‘ Safari:' Unkonw ';}Catch(e) {};Try{nv.version= (nv.name== ' IE ')? Ua.match (/msie ([\d.] +)/) [1]:(Nv.name= = ' Firefox ')? Ua.match (/firefox\/([\d.] +)/) [1]:(Nv.name= = ' Chrome ')? Ua.match (/chrome\/([\d.] +)/) [1]:(Nv.name= = ' opera ')? Ua.match (/opera. ( [\d.] +)/) [1]:(Nv.name= = ' Safari ')? Ua.match (/version\/([\d.] +)/) [1]:' 0 ';}Catch(e) {};Try{Nv.shell= (Ua.indexof (' 360ee ') >-1)? ' 360 Speed Browser ':(Ua.indexof (' 360SE ') >-1)? ' 360 Secure Browser ':(Ua.indexof (' SE ') >-1)? ' Sogou Browser ':(Ua.indexof (' Aoyou ') >-1)? ' Surfing the browser ':(Ua.indexof (' TheWorld ') >-1)? ' window of the World browser ':(Ua.indexof (' Worldchrome ') >-1)? ' window of the World Speed Browser ':(Ua.indexof (' Greenbrowser ') >-1)? ' Green Browser ':(Ua.indexof (' Qqbrowser ') >-1)? ' QQ Browser ':(Ua.indexof (' Baidu ') >-1)? ' Baidu Browser ':' Unknown or no shell ';}Catch(e) {}Switch(name) { Case' UA ': Case' UA ': br=ua; Break; Case' Name ': br=nv.name; Break; Case' Version ': br=nv.version; Break; Case' Shell ': br=nv.shell; Break;default: br=Nv.name;}return( BR;});}) (jQuery); Call method (must load this plug-in): $ (function() {alert (' Browser ua= ' +$. NV (' UA ') + ' \ n \ nthe browser name = ' +$. NV (' name ') + ' \ n \ nthe browser version = ' +parseint ($. NV (' version ')) + ' \ n \ nthe browser shell = ' +$. NV (' Shell '));}); This is basically complete.
Js/jquery determine browser name, kernel version, browser shell