Created
November 4, 2011 03:09
-
-
Save sx/1338574 to your computer and use it in GitHub Desktop.
UserAgent sniffer
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
var browsers = [ 'Firefox', 'IEMobile', 'MSIE', 'Android', 'BlackBerry', 'iPhone', 'Chrome', 'Safari', 'Opera Mini', 'Opera' ], | |
thisBrowser = ( function() { | |
for ( var i = 0, bl = browsers.length; i < bl; i++ ) { | |
if ( !!~navigator.userAgent.indexOf( browsers[i] ) ) { | |
return browsers[i]; | |
} | |
} | |
})() || 'Unknown'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment