Skip to content

Commit

Permalink
Check for iPadOS using maxTouchPoints so iOS workarounds work for iPa…
Browse files Browse the repository at this point in the history
…dOS and iOS

FIX: Fix platform detection on recent iPadOS versions, restoring several workarounds for bugs that were accidentally turned off there.
  • Loading branch information
Jesse authored Dec 11, 2020
1 parent e3f8648 commit aad52c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ if (typeof navigator != "undefined" && typeof document != "undefined") {
let chrome = !ie && /Chrome\/(\d+)/.exec(navigator.userAgent)
result.chrome = !!chrome
result.chrome_version = chrome && +chrome[1]
result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent)
// Is true for both iOS and iPadOS for convenience
result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && (/Mobile\/\w+/.test(navigator.userAgent) || !!(navigator.maxTouchPoints && navigator.maxTouchPoints > 2))
result.android = /Android \d/.test(navigator.userAgent)
result.webkit = "webkitFontSmoothing" in document.documentElement.style
result.safari = /Apple Computer/.test(navigator.vendor)
Expand Down

0 comments on commit aad52c0

Please sign in to comment.