Skip to content

Commit d16de32

Browse files
committed
Device.iOSVersion now contains the major version number of iOS.
1 parent 27457c2 commit d16de32

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/system/Device.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ Phaser.Device = function () {
5757
*/
5858
this.iOS = false;
5959

60+
/**
61+
* @property {number} iOSVersion - If running in iOS this will contain the major version number.
62+
* @default
63+
*/
64+
this.iOSVersion = 0;
65+
6066
/**
6167
* @property {boolean} cocoonJS - Is the game running under CocoonJS?
6268
* @default
@@ -658,6 +664,8 @@ Phaser.Device._initialize = function () {
658664
else if (/iP[ao]d|iPhone/i.test(ua))
659665
{
660666
device.iOS = true;
667+
var v = (navigator.appVersion).match(/OS (\d+)/);
668+
device.iOSVersion = parseInt(RegExp.$1, 10);
661669
}
662670
else if (/Linux/.test(ua))
663671
{

0 commit comments

Comments
 (0)