Created
December 17, 2012 00:36
-
-
Save Ivanca/4314663 to your computer and use it in GitHub Desktop.
Get Internet Explorer version; or return undefined if it is NOT internet explorer.
Modded from james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/
Unfortunately IE10 doesn't accept HTML conditional statements, so we have to use a JS conditional statement.
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
var ie = (function(){ | |
var undef, | |
v = 3, | |
div = document.createElement('div'), | |
all = div.getElementsByTagName('i'); | |
do { | |
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->'; | |
} while(all[0]); | |
/*@cc_on;if(v<5)v=10;@*/ | |
return v > 4 ? v : undef ; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
E.g.