Skip to content

Commit

Permalink
fix(BrowserCapabilities) fix detecting WKWebView on iPad
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Aug 15, 2024
1 parent 134aac1 commit 526ec25
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/browser/BrowserCapabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const MIN_REQUIRED_FIREFOX_VERSION = 91;
const MIN_REQUIRED_SAFARI_VERSION = 14;
const MIN_REQUIRED_IOS_VERSION = 14;

// Starting with iPadOS 13 the actual Safari / iPadOS version is concealed from the UA string and
// the system pretends to be macOS 10.15.7. Yeah, you read that right.
const FROZEN_MACOS_VERSION = '10.15.7';

// TODO: Move this code to js-utils.

// NOTE: Now we are extending BrowserDetection in order to preserve
Expand Down Expand Up @@ -90,6 +94,11 @@ export default class BrowserCapabilities extends BrowserDetection {
* @returns {boolean} true if the browser is supported for iOS devices
*/
isSupportedIOSBrowser() {
// After iPadOS 13 we have no way to know the Safari or iPadOS version, so YOLO.
if (!this.isSafari() && this.isWebKitBased() && this.getOSVersion() === FROZEN_MACOS_VERSION) {
return true;
}

return this._getSafariVersion() >= MIN_REQUIRED_IOS_VERSION
|| this._getIOSVersion() >= MIN_REQUIRED_IOS_VERSION;
}
Expand Down

0 comments on commit 526ec25

Please sign in to comment.