summaryrefslogtreecommitdiff
path: root/ext/js/background/environment.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-04-10 23:55:11 -0400
committerGitHub <noreply@github.com>2021-04-10 23:55:11 -0400
commit20d60a2ba79c065586805806ea703a8057839f75 (patch)
tree3043090e118e03a8e276d2a7f1557e525ac23239 /ext/js/background/environment.js
parentb23c4bff4bf319ea79eea0d025e21eb19e6dcd68 (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.js14
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')
+ );
+ }
}