Skip to content

Commit 4cefe70

Browse files
committed
Since iOS 13, iPads now identify as MacOS devices. A new maxTouchPoint check is now part of the Device.OS tests, stopping iPads from being flagged as desktop devices. Fix phaserjs#5389
1 parent 52710ad commit 4cefe70

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/device/OS.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,20 @@ function init ()
6969
}
7070
else if ((/Mac OS/).test(ua) && !((/like Mac OS/).test(ua)))
7171
{
72-
OS.macOS = true;
72+
// Because iOS 13 identifies as Mac OS:
73+
if (navigator.maxTouchPoints && navigator.maxTouchPoints > 2)
74+
{
75+
OS.iOS = true;
76+
OS.iPad = true;
77+
78+
(navigator.appVersion).match(/Version\/(\d+)/);
79+
80+
OS.iOSVersion = parseInt(RegExp.$1, 10);
81+
}
82+
else
83+
{
84+
OS.macOS = true;
85+
}
7386
}
7487
else if ((/Android/).test(ua))
7588
{

0 commit comments

Comments
 (0)