summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-10 11:41:19 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-11-03 10:28:54 +0000
commit7c841a63171c168f8eeeaca3d5a3f47fb4b6f369 (patch)
tree1b572a3158ae2c5b2a347d2520a98e51f5b75cfc
parentbc2f496690d15e0be91f44e7120b381b283edf08 (diff)
Handle invalid browser versions more gracefully and fix Safari iPadOS 15.7
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--src/mixins/browserCheck.js29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/mixins/browserCheck.js b/src/mixins/browserCheck.js
index c57b9a57f..bdd3c0dba 100644
--- a/src/mixins/browserCheck.js
+++ b/src/mixins/browserCheck.js
@@ -37,9 +37,12 @@ const browserCheck = {
},
},
computed: {
+ parser() {
+ return new UAParser()
+ },
+
browser() {
- const parser = new UAParser()
- return parser.getBrowser()
+ return this.parser.getBrowser()
},
isFirefox() {
@@ -61,8 +64,28 @@ const browserCheck = {
return this.browser.name === 'IE' || this.browser.name === 'IEMobile'
},
+ browserVersion() {
+ if (this.browser.version) {
+ return this.browser.version
+ }
+
+ if (this.browser.name === 'Safari') {
+ // Workaround for https://github.com/faisalman/ua-parser-js/issues/599
+ const match = this.parser.getUA().match(' Version/([0-9.,]+) ')
+ if (match) {
+ return match[1]
+ }
+ }
+
+ return undefined
+ },
+
majorVersion() {
- return parseInt(this.browser.version.split('.')[0], 10)
+ if (this.browserVersion) {
+ return parseInt(this.browserVersion.split('.')[0], 10)
+ }
+
+ return 0
},
isFullySupported() {