Created
October 20, 2016 09:49
-
-
Save robotnealan/9d5443d10a2978a411f6200cb63c7976 to your computer and use it in GitHub Desktop.
A simple function to check the version of Android devices.
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
// whichAndroid() | |
// | |
// Checks the userAgent to see if it's an Android device and returns the version | |
// number if true. Returns false on all other browsers/devices. | |
let whichAndroid = function() { | |
var userAgent = navigator.userAgent.toLowerCase(); | |
var check = userAgent.match(/android\s([0-9\.]*)/); | |
return check ? check[1] : false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment