public
Last active — forked from padolsey/gist:527683

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// ----------------------------------------------------------
// 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);
}());

if(!ie) { alert ('IE is Kryptonite.'); }

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.