Created
August 8, 2015 02:51
-
-
Save yallups/4b21e737d593f9bf79b3 to your computer and use it in GitHub Desktop.
First version of a is supported browser function dependent on jquery
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
function isSupportedBrowser() { | |
var $browser = jQuery.browser, | |
supportedBrowsers = { // Order is important | |
'android': 4, | |
'chrome' : 34, | |
'safari' : 7, | |
'mozilla': 37, | |
'msie' : 10 | |
}, | |
b, android = getAndroidVersion(); | |
if (android) { | |
$browser.android = true; | |
$browser.version = android; | |
} | |
for (b in supportedBrowsers) { | |
if ($browser[b]) { | |
return parseInt($browser.version) >= supportedBrowsers[b]; | |
} | |
} | |
return false; | |
} | |
function getAndroidVersion(ua) { | |
ua = (ua || navigator.userAgent).toLowerCase(); | |
var match = ua.match(/android\s([0-9\.]*)/); | |
return match ? match[1] : false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment