Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created June 27, 2013 03:11
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelrinaldi/5873671 to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/5873671 to your computer and use it in GitHub Desktop.
Checks which iOS version is running.
// http://stackoverflow.com/a/14223920/339827
function iOSVersion() {
var match = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/),
version = [
parseInt(match[1], 10),
parseInt(match[2], 10),
parseInt(match[3] || 0, 10)
];
return parseFloat(version.join('.'));
}
@jt3k
Copy link

jt3k commented May 7, 2019

match returns only array or null

@archsiva
Copy link

can I use this to detect ios 12 version? will it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment