Created
April 27, 2012 08:40
-
-
Save nesterchung/2507519 to your computer and use it in GitHub Desktop.
Javascript: Internet Explorer detection.
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
// 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) { | |
// | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from Formalize