Skip to content

Instantly share code, notes, and snippets.

@nesterchung
Created April 27, 2012 08:40
Show Gist options
  • Save nesterchung/2507519 to your computer and use it in GitHub Desktop.
Save nesterchung/2507519 to your computer and use it in GitHub Desktop.
Javascript: Internet Explorer detection.
// Internet Explorer detection.
function IE(version) {
var b = document.createElement('b');
b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
return !!b.getElementsByTagName('br').length;
}
//Example
var IE6 = IE(6);
var IE7 = IE(7);
if (IE6) {
//
} else if (IE7) {
//
}
@nesterchung
Copy link
Author

from Formalize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment