Skip to content

Instantly share code, notes, and snippets.

@rahulcn
Created April 22, 2013 11:05
Show Gist options
  • Save rahulcn/5433951 to your computer and use it in GitHub Desktop.
Save rahulcn/5433951 to your computer and use it in GitHub Desktop.
Check for browser javascript.
check_browser: (navigator) ->
N = navigator.appName
ua = navigator.userAgent
tem = undefined
M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i)
M[2] = tem[1] if M and (tem = ua.match(/version\/([\.\d]+)/i))?
M = (if M then [M[1], M[2]] else [N, navigator.appVersion, "-?"])
M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment