Created
January 16, 2013 04:13
-
-
Save tipiirai/4544584 to your computer and use it in GitHub Desktop.
jQuery.browser for v1.9+
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
/* | |
jQuery.browser for 1.9+ | |
We all love feature detection but that's sometimes not enough. | |
@author Tero Piirainen | |
*/ | |
!function($) { | |
if (!$.browser) { | |
var b = $.browser = {}, | |
ua = navigator.userAgent.toLowerCase(), | |
match = /(chrome)[ \/]([\w.]+)/.exec(ua) || | |
/(webkit)[ \/]([\w.]+)/.exec(ua) || | |
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || | |
/(msie) ([\w.]+)/.exec(ua) || | |
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; | |
if (match[1]) { | |
b[match[1]] = true; | |
b.version = match[2] || "0"; | |
} | |
} | |
}(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example Safari prior to v5.1.14 has a broken WebSocket support
socketio/socket.io#193