Determine the browser version and the browser kernel, and determine the browser kernel
If (! Browser. ie &&! Browser. mac) {var UA = navigator. userAgent. toLowerCase (). toString (); // determines whether it is a non-IE version in the IE kernel if (UA. indexOf ('ee')>-1) | (UA. indexOf ('360se')>-1) | (UA. indexOf ('se')>-1) | (UA. indexOf ('aoyou')>-1) | (UA. indexOf ('theworld')>-1) | (UA. indexOf ('worldchrome ')>-1) | (UA. indexOf ('greenbrowser ')>-1) | (UA. indexOf ('baidu')>-1) | (UA. indexOf ('qqbrowser ')>-1) {// Yes, switch to compatible mode window. op En ("publicPage/point-se.aspx");} else {// if not, it is recommended to change the browser alert ('suggested to change to IE kernel browser ');}} else {// determine the version and model of IE if (browser. version = 10 & browser. ie10Compat) | (browser. version = 11 & browser. ie11Compat) {window. open ("publicPage/point. aspx ");}/** @ desc judge the browser version and the browser kernel * @ author wangyanling * @ date July 22, July 4, 2014 */var browser = function () {var agent = navigator. userAgent. toLowerCase (), opera = win Dow. opera, browser = {// check whether the current browser is IE ie IE:/(msie \ s | trident. * rv :) ([\ w.] + )/. test (agent), // check whether the current browser is Opera opera :(!! Opera & opera. version), // check whether the current browser is a webkit kernel browser webkit: (agent. indexOf ('applewebkit/')>-1), // checks whether the current browser is running on mac: (agent. indexOf ('macintosh ')>-1), // checks whether the current browser is in "weird mode" quirks: (document. compatMode = 'backcomput')}; // checks whether the current browser kernel is gecko kernel browser. gecko = (navigator. product = 'gecko '&&! Browser. webkit &&! Browser. opera &&! Browser. ie); var version = 0; // Internet Explorer 6.0 + if (browser. ie) {var v1 = agent. match (/(?: Msie \ s ([\ w.] +)/); var v2 = agent. match (/(?: Trident. * rv :( [\ w.] +)/); if (v1 & v2 & v1 [1] & v2 [1]) {version = Math. max (v1 [1] * 1, v2 [1] * 1);} else if (v1 & v1 [1]) {version = v1 [1] * 1 ;} else if (v2 & v2 [1]) {version = v2 [1] * 1;} else {version = 0 ;} // check whether the browser mode is IE11 compatible. ie11Compat = document.doc umentMode = 11; // checks whether the browser mode is IE9 compatible with browser. ie9Compat = document.doc umentMode = 9; // checks whether the browser mode is IE10 compatible with browser. ie10Com Pat = document.doc umentMode = 10; // check whether the browser is IE8 browser. ie8 = !! Document.doc umentMode; // checks whether the browser mode is IE8 compatible browser. ie8Compat = document.doc umentMode = 8; // checks whether the browser mode is IE7 compatible with browser. ie7Compat = (version = 7 &&! Document.doc umentMode) | document.doc umentMode = 7); // checks whether the browser mode is IE6 or weird. ie6Compat = (version <7 | browser. quirks); browser. ie9above = version> 8; browser. ie9below = version <9;} // Gecko. if (browser. gecko) {var geckoRelease = agent. match (/rv :( [\ d \.] +)/); if (geckoRelease) {geckoRelease = geckoRelease [1]. split ('. '); version = geckoRelease [0] * 10000 + (geckoRelease [1] | 0) * 100 + (geckoRelease [2] | 0) * 1 ;}/// check whether the current browser is Chrome. If yes, if (/Chrome \/(\ d + \. \ d)/I. test (agent) {browser. chrome = + RegExp ['\ x241'];} // checks whether the current browser is Safari. if yes, the Safari version if (/(\ d ++ \. \ d )? (?: \. \ D )? \ S + safari \/? (\ D + \. \ d + )? /I. test (agent )&&! /Chrome/I. test (agent) {browser. safari = + (RegExp ['\ x241'] | RegExp ['\ x242']);} // Opera 9.50 + if (browser. opera) version = parseFloat (opera. version (); // WebKit 522 + (Safari 3 +) if (browser. webkit) version = parseFloat (agent. match (/applewebkit \/(\ d +)/) [1]); // check the current browser version number browser. version = version; return browser ;}();