From cdfa115ec0772da9af1beaf7213d9c7f3d7bbf53 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Wed, 13 Nov 2019 22:00:27 +0300 Subject: [PATCH 1/2] Fix iOS platform detection #572 --- src/scripts/browser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/browser.js b/src/scripts/browser.js index 6329bbbd13..b76c0f7cc5 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -122,7 +122,7 @@ define([], function () { } function iOSversion() { - if (/iP(hone|od|ad)/.test(navigator.platform)) { + if (/iP(hone|od|ad)|MacIntel/.test(navigator.platform)) { // supports iOS 2.0 and later: var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)]; From 11b6e83d69a01e24076f165ce73bb08defab7245 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Thu, 14 Nov 2019 16:29:33 +0300 Subject: [PATCH 2/2] Apply suggestions from code review --- src/scripts/browser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scripts/browser.js b/src/scripts/browser.js index b76c0f7cc5..a50eeaa608 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -122,6 +122,7 @@ define([], function () { } function iOSversion() { + // MacIntel: Apple iPad Pro 11 iOS 13.1 if (/iP(hone|od|ad)|MacIntel/.test(navigator.platform)) { // supports iOS 2.0 and later: var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); @@ -301,7 +302,10 @@ define([], function () { if (browser.iOS) { browser.iOSVersion = iOSversion(); - browser.iOSVersion = browser.iOSVersion[0] + (browser.iOSVersion[1] / 10); + + if (browser.iOSVersion && browser.iOSVersion.length >= 2) { + browser.iOSVersion = browser.iOSVersion[0] + (browser.iOSVersion[1] / 10); + } } browser.chromecast = browser.chrome && userAgent.toLowerCase().indexOf('crkey') !== -1;