diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-04-10 23:55:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-10 23:55:11 -0400 |
commit | 20d60a2ba79c065586805806ea703a8057839f75 (patch) | |
tree | 3043090e118e03a8e276d2a7f1557e525ac23239 /ext/js/background/environment.js | |
parent | b23c4bff4bf319ea79eea0d025e21eb19e6dcd68 (diff) |
Initial safari compatibility (#1609)
* Update environment info to return the 'safari' browser
* Fix popup display on Safari
* Update environment assignment
* Add data-loading-stalled property when loading takes longer than expected
* Add notification when loading has stalled
* Allow getDictionaryInfo invocation on non-privileged contexts
* Update _validatePrivilegedMessageSender
* Don't listen to 'voiceschanged' event unless addEventListener is present
Also expose an event
Diffstat (limited to 'ext/js/background/environment.js')
-rw-r--r-- | ext/js/background/environment.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/js/background/environment.js b/ext/js/background/environment.js index 04099ca1..8111741f 100644 --- a/ext/js/background/environment.js +++ b/ext/js/background/environment.js @@ -83,9 +83,23 @@ class Environment { } catch (e) { // NOP } + if (this._isSafari()) { + return 'safari'; + } return 'firefox'; } else { return 'chrome'; } } + + _isSafari() { + const {vendor, userAgent} = navigator; + return ( + typeof vendor === 'string' && + typeof userAgent === 'string' && + vendor.includes('Apple') && + !userAgent.includes('CriOS') && + !userAgent.includes('FxiOS') + ); + } } |