Created
June 28, 2011 04:29
-
-
Save fuhoi/1050495 to your computer and use it in GitHub Desktop.
javascript-ie-mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* JavaScript to determine browser mode */ | |
function getEngine(){ | |
var _eng; | |
if(window.navigator.appName=="Microsoft Internet Explorer"){ // This is an IE browser. What mode is the engine in? | |
if(document.documentMode){ // IE8 or later | |
_eng = document.documentMode; | |
} else { // IE 5-7 | |
_eng = 5; // Assume quirks mode unless proven otherwise | |
if(document.compatMode){ | |
if(document.compatMode == "CSS1Compat") { | |
_eng = 7; // standards mode | |
} | |
} | |
// There is no test for IE6 standards mode because that mode | |
// was replaced by IE7 standards mode; there is no emulation. | |
} | |
// the engine variable now contains the document compatibility mode. | |
} | |
return _eng; | |
} // getEngine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment