Created
September 11, 2012 21:47
-
-
Save buzzedword/3702329 to your computer and use it in GitHub Desktop.
Minified UA library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint browser: true, regexp: true, maxerr: 50, indent: 4 *//** | |
* A UserAgent detection library. | |
* | |
* This library relies on the navigator.userAgent property and hence does not | |
* work for custom UserAgent settings. | |
* | |
* Apart from supporting detection of major browser vendors, the library also | |
* supports detection of various devices. | |
* | |
* Copyright (c) 2012, Gopalarathnam Venkatesan | |
* All rights reserved. | |
* | |
* @module UA | |
*/var UA=function(){"use strict";var e=window.navigator&&navigator.userAgent||"";return{isChrome:function(){return/webkit\W.*(chrome|chromium)\W/i.test(e)},isFirefox:function(){return/mozilla.*\Wfirefox\W/i.test(e)},isGecko:function(){return/mozilla(?!.*webkit).*\Wgecko\W/i.test(e)},isIE:function(){return navigator.appName==="Microsoft Internet Explorer"},isKindle:function(){return/\W(kindle|silk)\W/i.test(e)},isMobile:function(){return/(iphone|ipod|(android.*?mobile)|blackberry|nokia)/i.test(e)},isOpera:function(){return/opera.*\Wpresto\W/i.test(e)},isSafari:function(){return/webkit\W(?!.*chrome).*safari\W/i.test(e)},isTablet:function(){return/(ipad|android(?!.*mobile))/i.test(e)},isTV:function(){return/googletv|sonydtv/i.test(e)},isWebKit:function(){return/webkit\W/i.test(e)},whoami:function(){return e}}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment