Last active
December 27, 2016 05:29
-
-
Save baskeboler/293cbe4f872f72ee52ff3b3ae9b15dd6 to your computer and use it in GitHub Desktop.
checking if we are on iphone 6 plus or higher with cordova device.model
This file contains hidden or 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
var modelString = device.model; | |
var modelRegex = /\d+/g; | |
var isIPhone6PlusOrHigher = false; | |
var match = modelString.match(modelRegex); | |
if (match != null) { | |
var major = match[0], minor = match[1]; | |
if (major == 7) { | |
if (minor != 2) { | |
// iphone 6 plus | |
isIPhone6PlusOrHigher = true; | |
} | |
} else if (major > 7) { | |
isIPhone6PlusOrHigher = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment