if(!browser.ie &&!)Browser.mac) {varUA =navigator.userAgent.toLowerCase (). toString (); //determine if it is not a non-IE version under IE kernel if((Ua.indexof (' 360ee ') >-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 compatibility mode.window.open ("Publicpage/point-se.aspx"); } Else { //if not, we recommend changing the browserAlert (' Switch to IE kernel browser ')); } } Else { //determine the version of IE model if(browser.version = && Browser.ie10compat) | | (Browser.version = = &&Browser.ie11compat)) {window.open ("Publicpage/point.aspx"); }
}/** @desc to determine browser version and browser kernel * @author wangyanling * @date July 4, 2014*/ varBrowser =function () { varAgent =Navigator.userAgent.toLowerCase (), opera=Window.opera, Browser= { //detects if the current browser is IEie:/(MSIE\S|TRIDENT.*RV:) ([\w.] +)/. Test (agent),//detects if the current browser is operaOpera: (!! Opera &&opera.version),//detects if the current browser is a WebKit kernel browserWebKit: (Agent.indexof (' applewebkit/') >-1), //detects if the current browser is running under the Mac platformMac: (Agent.indexof (' Macintosh ') >-1), //detects if the current browser is in "weird mode"Quirks: (Document.compatmode = = ' Backcompat ')) }; //detects if the current browser kernel is a gecko kernelBrowser.gecko = (Navigator.product = = ' Gecko ' &&!browser.webkit &&!browser.opera &&!browser.ie); varVersion = 0; //Internet Explorer 6.0+ if(browser.ie) {varV1 = Agent.match (/(?: msie\s ([\w.] +))/); varV2 = 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; } //detect if Browser mode is IE11 compatibility modeBrowser.ie11compat = Document.documentmode = = 11; //detect if Browser mode is IE9 compatibility modeBrowser.ie9compat = Document.documentmode = = 9; //detect if Browser mode is IE10 compatibility modeBrowser.ie10compat = Document.documentmode = = 10; //detects if the browser is a IE8 browserBROWSER.IE8 =!!Document.documentmode; //detect if Browser mode is IE8 compatibility modeBrowser.ie8compat = Document.documentmode = = 8; //detect if Browser mode is IE7 compatibility modeBrowser.ie7compat = (Version = = 7 &&!document.documentmode) | | document.documentmode = = 7); //detects if browser mode is IE6 mode or weird modeBrowser.ie6compat = (Version < 7 | |browser.quirks); Browser.ie9above= version > 8; Browser.ie9below= Version < 9; } //Gecko. if(Browser.gecko) {varGeckorelease = Agent.match (/rv: ([\d\.] +)/); if(geckorelease) {geckorelease= Geckorelease[1].split ('. ')); Version= geckorelease[0] * 10000 + (Geckorelease[1] | | 0) * + (geckorelease[2] | | 0) * 1; } } //detects if the current browser is chrome, and if so, returns the large version number of chrome if(/chrome\/(\d+\.\d)/i.test (agent)) {Browser.chrome= +regexp[' \x241 ']; } //detects if the current browser is safari and, if so, returns the large version number of Safari 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) if(browser.webkit) version= Parsefloat (Agent.match (/applewebkit\/(\d+)/) [1]); //detects the current browser version numberBrowser.version =version; returnBrowser; }();
Determine the browser version and browser kernel