Skip to content

Instantly share code, notes, and snippets.

@chenwery
Last active August 29, 2015 13:56
Show Gist options
  • Save chenwery/9243282 to your computer and use it in GitHub Desktop.
Save chenwery/9243282 to your computer and use it in GitHub Desktop.
IE version
检测IE浏览器的版本
var isIE = !!window.ActiveXObject;
var isIE6 = isIE && !window.XMLHttpRequest;
var isIE8 = isIE && !!document.documentMode;
var isIE7 = isIE && !isIE6 && !isIE8;
if (isIE) {
if (isIE6) {
alert('ie6');
} else if (isIE8) {
alert('ie8');
} else if (isIE7) {
alert('ie7');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment