Last active
August 29, 2015 13:57
-
-
Save enumag/9771736 to your computer and use it in GitHub Desktop.
IE detector
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
(function(){ | |
var agent = navigator.userAgent.toLowerCase(); | |
if (/trident/.test(agent)) { | |
var version = (/msie ([\w.]+)/.exec(agent) || agent.indexOf('compatible') < 0 && /mozilla(?:.*? rv:([\w.]+)|)/.exec(agent) || [])[1]; | |
if (version) { | |
document.documentElement.className += ' ie' + parseInt(version); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment