function getAndroidVersion(ua) {
ua = (ua || navigator.userAgent).toLowerCase();
var match = ua.match(/android\s([0-9\.]*)/i);
return match ? match[1] : undefined;
};
getAndroidVersion(); //"4.2.1"
parseInt(getAndroidVersion(), 10); //4
parseFloat(getAndroidVersion()); //4.2
More Related Contents:
- How to focus an input field on Android browser through javascript or jquery
- How can I tell if a DOM element is visible in the current viewport?
- Is there a way to detect if a browser window is not currently active?
- How to detect page zoom level in all modern browsers?
- Communication between tabs or windows
- How do I render a Word document (.doc, .docx) in the browser using JavaScript?
- Difference between DOMContentLoaded and load events
- How to get a word under cursor using JavaScript?
- How can I detect when the mouse leaves the window?
- get client time zone from browser [duplicate]
- Using HTML comment tag still relevant around JavaScript code?
- Can I pass a JavaScript variable to another browser window?
- Phonegap – Save image from url into device photo gallery
- Disabling the context menu on long taps on Android
- Detect when user accepts to download a file
- How to detect timeout on an AJAX (XmlHttpRequest) call in the browser?
- Detecting if a browser is in full screen mode
- Target=’_blank’ to show in new window, NOT new tab, possible?
- How to find Javascript syntax errors? [closed]
- Invoke native date picker from web-app on iOS/Android
- Recovering built-in methods that have been overwritten
- How does JavaScript VM implements Object property access? Is it Hashtable?
- HTML5 Audio can’t play through Javascript unless triggered manually once
- The javascript “resizeTo” function not working in Chrome and Opera
- Open Gmail on mailto: action
- Trigger events when the window is scrolled to certain positions
- Browsers automatically evaluate hex or hsl colors to rgb when setting via element.style.background?
- How to detect if web app running standalone on Chrome mobile
- Android Phonegap – How to Open Native Google Maps Application
- Could a website force the browser to go into fullscreen mode?