diff --git a/src/misc/utils.ts b/src/misc/utils.ts index c7f3eeccca..585cdeff83 100644 --- a/src/misc/utils.ts +++ b/src/misc/utils.ts @@ -11,6 +11,7 @@ export class Utils { static isNode = false; static isBrowser = true; static isMobileBrowser = false; + static isAppleMobileBrowser = false; static global: any = null; static tldEndingRegex = /.*\.(com|net|org|edu|uk|gov|ca|de|jp|fr|au|ru|ch|io|es|us|co|xyz|info|ly|mil)$/; @@ -25,6 +26,7 @@ export class Utils { Utils.isBrowser = typeof window !== 'undefined'; Utils.isNativeScript = !Utils.isNode && !Utils.isBrowser; Utils.isMobileBrowser = Utils.isBrowser && this.isMobile(window); + Utils.isAppleMobileBrowser = Utils.isBrowser && this.isAppleMobile(window); Utils.global = Utils.isNativeScript ? global : (Utils.isNode && !Utils.isBrowser ? global : window); } @@ -257,6 +259,10 @@ export class Utils { return mobile || win.navigator.userAgent.match(/iPad/i) != null; } + private static isAppleMobile(win: Window) { + return win.navigator.userAgent.match(/iPhone/i) != null || win.navigator.userAgent.match(/iPad/i) != null; + } + private static getUrl(uriString: string): URL { if (uriString == null) { return null;