// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// if (ie) { alert('IE ' + ie); } // else ie version is not a number; | |
// if(!ie) { alert ('IE is Kryptonite.'); } | |
var ie = (function(){ | |
var div = document.createElement('div'); | |
for (v=6;v<=9;v++) | |
div.innerHTML += '<!--[if IE ' + v + ']>' + v + '<![endif]-->' | |
return parseInt(div.innerHTML); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
if(!ie) { alert ('IE is Kryptonite.'); }