Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/mixins/browserCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ const browserCheck = {
},
},
computed: {
parser() {
return new UAParser()
},

browser() {
const parser = new UAParser()
return parser.getBrowser()
return this.parser.getBrowser()
},

isFirefox() {
Expand All @@ -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() {
Expand Down