A jQuery plugin for browser detection. jQuery removed support for browser detection on 1.9.1 so it was abstracted into a jQuery plugin
Include script after the jQuery library:
<script src="/path/to/jquery.browser.js"></script>
Returns true if the current useragent is some version of Microsoft's Internet Explorer. Supports all IE versions including IE11
$.browser.msie;
Returns true if the current useragent is some version of a Webkit browser (Safari, Chrome and Opera 15+).
$.browser.webkit;
Returns true if the current useragent is some version of Firefox.
$.browser.mozilla;
Reading the browser verion
$.browser.version
- Detect Windows, Mac, Linux, iPad, iPhone and Android useragents
$.browser.ipad
$.browser.iphone
$.browser.android
$.browser.win
$.browser.mac
$.browser.linux
- Support for new useragent on IE11
- Support for webkit based Opera browsers
Testing for this plugin is done with Casperjs v1.1 to take advantage of multiple phantomjs browsers with different user agents.
For instructions on how to install Casperjs v1.1 go to http://docs.casperjs.org/en/latest/installation.html
Note: Testing requires Casperjs v1.1
Once Casperjs is properly installed you can execute the tests using:
casperjs test test/test.js
- Source hosted at GitHub
- Report issues, questions, feature requests on GitHub Issues