Skip to content

Instantly share code, notes, and snippets.

@klzns
Forked from tzi/index.html
Last active December 14, 2015 09:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klzns/5066139 to your computer and use it in GitHub Desktop.
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.
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