Skip to content

Instantly share code, notes, and snippets.

@raym
Last active August 29, 2015 14:08
Show Gist options
  • Save raym/70f2c6af4bd91cb9fb72 to your computer and use it in GitHub Desktop.
Save raym/70f2c6af4bd91cb9fb72 to your computer and use it in GitHub Desktop.
Browser detection
var
is_chrome = navigator.userAgent.indexOf('Chrome') > -1,
is_safari = navigator.userAgent.indexOf("Safari") > -1 && !is_chrome,
is_firefox = navigator.userAgent.indexOf('Firefox') > -1,
is_explorer = (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0),
is_opera = navigator.userAgent.indexOf("Presto") > -1
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment