Created
January 12, 2011 12:12
-
-
Save Takazudo/776082 to your computer and use it in GitHub Desktop.
detect legacy android
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
$.browser.android = /android/i.test(ua); | |
$.browser.legacyAndroid = function(){ | |
if(!$.browser.android){ | |
return false; | |
} | |
var threshold = 2.2; | |
var res = ua.match(/android\s?([^;^-]+)/i); | |
if(!res || res.length<2){ | |
return false; | |
} | |
var version = res[1]; | |
if(version.match(/\./g).length>1){ | |
version = version.replace(/(\d+\.\d+)\..+/,'$1'); // cut minor versions. ex: 1.6.1 to 1.6 | |
} | |
version = version*1; | |
if(version >= threshold){ | |
return false; | |
} | |
return true; | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment