-
-
Save klzns/5066139 to your computer and use it in GitHub Desktop.
Detect Internet Explorer version in Coffeescript. Returns IE version number if true, otherwise returns false.
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
window.dammitIE = do -> | |
is_internet_explorer = -> | |
window.navigator.appName is "Microsoft Internet Explorer" | |
get_internet_explorer_version = -> | |
matches = new RegExp(" MSIE ([0-9].[0-9]);").exec(window.navigator.userAgent) | |
return parseInt(matches[1].replace(".0", "")) if matches? and matches.length > 1 | |
true | |
return get_internet_explorer_version() if is_internet_explorer() | |
false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment