Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Created January 12, 2011 12:12
Show Gist options
  • Save Takazudo/776082 to your computer and use it in GitHub Desktop.
Save Takazudo/776082 to your computer and use it in GitHub Desktop.
detect legacy android
$.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