GULANGGULING.COM

Get Android version with javascript

Hi All,

This is the simple way to get Android Version from javascript.

function getAndroidVersion(ua) {
 var ua = ua || navigator.userAgent; 
 var match = ua.match(/Android\s([0-9\.]*)/);
 return match ? match[1] : false;
};

Simple way to use:

if (navigator.userAgent.match(/android/ig)) {
 alert(getAndroidVersion());
}

Done