Skip to content

Instantly share code, notes, and snippets.

@atatos
Created July 26, 2013 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atatos/6087850 to your computer and use it in GitHub Desktop.
Save atatos/6087850 to your computer and use it in GitHub Desktop.
Detecting browsers in jQuery 1.9
//Bring back the browser object
jQuery.browser = {};
//Rest all is self explanatory.
jQuery.browser.mozilla = /mozilla/.test(navigator.userAgent.toLowerCase())
&& !/webkit/.test(navigator.userAgent.toLowerCase());
jQuery.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
jQuery.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());
jQuery.browser.msie = /msie/.test(navigator.userAgent.toLowerCase());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment