Skip to content

Instantly share code, notes, and snippets.

@Aeramor
Last active December 23, 2015 02:39
Show Gist options
  • Save Aeramor/01ccea38b17b98cf1d39 to your computer and use it in GitHub Desktop.
Save Aeramor/01ccea38b17b98cf1d39 to your computer and use it in GitHub Desktop.
function iOSversion() {
if (/iP(hone|od|ad)/.test(navigator.platform)) {
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
}
}
@Aeramor
Copy link
Author

Aeramor commented Sep 15, 2013

Use it like this:
ver = iOSversion();

if (ver[0] >= 5) {
alert('This is running iOS 5 or later.');
}

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