Created
September 14, 2012 13:43
-
-
Save Takazudo/3721994 to your computer and use it in GitHub Desktop.
IE version 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
# IE version detection | |
# original: http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/ | |
ie = do -> | |
version = 3 | |
div = document.createElement 'div' | |
all = div.getElementsByTagName 'i' | |
refresh = -> | |
version += 1 | |
div.innerHTML = '<!--[if gt IE ' + (version) + ']><i></i><![endif]-->' | |
return | |
refresh() | |
while all[0] | |
refresh() | |
return version if version > 4 | |
false | |
alert ie # your version |
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
// IE version detection | |
// original: http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/ | |
var ie; | |
ie = (function() { | |
var all, div, refresh, version; | |
version = 3; | |
div = document.createElement('div'); | |
all = div.getElementsByTagName('i'); | |
refresh = function() { | |
version += 1; | |
div.innerHTML = '<!--[if gt IE ' + version + ']><i></i><![endif]-->'; | |
}; | |
refresh(); | |
while (all[0]) { | |
refresh(); | |
} | |
if (version > 4) { | |
return version; | |
} | |
return false; | |
})(); | |
alert(ie); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment