Skip to content

Instantly share code, notes, and snippets.

@laphilosophia
Created June 23, 2016 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laphilosophia/33052e84c87141150900a2d22fe6035c to your computer and use it in GitHub Desktop.
Save laphilosophia/33052e84c87141150900a2d22fe6035c to your computer and use it in GitHub Desktop.
Detect android version with javascript.
function getAndroidVersion(ua) {
ua = (ua || navigator.userAgent).toLowerCase();
var match = ua.match(/android\s([0-9\.]*)/);
return match ? match[1] : false;
};
var androidVersion = parseFloat(getAndroidVersion());
if (androidVersion === 4.4) {
// ..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment