Skip to content

Instantly share code, notes, and snippets.

@SubZane
Created April 23, 2014 11:46
Show Gist options
  • Save SubZane/11212185 to your computer and use it in GitHub Desktop.
Save SubZane/11212185 to your computer and use it in GitHub Desktop.
IE Detection Script
<script>
if (/\bMSIE 6/.test(navigator.userAgent) && !window.opera) {
document.documentElement.className+=' ie6';
} else if (navigator.appVersion.indexOf("MSIE 7.") != -1) {
document.documentElement.className+=' ie7';
} else if (navigator.appVersion.indexOf("MSIE 8.") != -1) {
document.documentElement.className+=' ie8';
} else if (navigator.appVersion.indexOf("MSIE 9.") != -1) {
document.documentElement.className+=' ie9';
} else if (/*@cc_on!@*/false && document.documentMode === 10) {
document.documentElement.className+=' ie10';
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment