aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/yomichan.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/yomichan.js')
-rw-r--r--ext/mixed/js/yomichan.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/mixed/js/yomichan.js b/ext/mixed/js/yomichan.js
index 5fa504ef..ab1afcd9 100644
--- a/ext/mixed/js/yomichan.js
+++ b/ext/mixed/js/yomichan.js
@@ -15,6 +15,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+// Set up chrome alias if it's not available (Edge Legacy)
+if ((() => {
+ let hasChrome = false;
+ let hasBrowser = false;
+ try {
+ hasChrome = (typeof chrome === 'object' && chrome !== null && typeof chrome.runtime !== 'undefined');
+ } catch (e) {
+ // NOP
+ }
+ try {
+ hasBrowser = (typeof browser === 'object' && browser !== null && typeof browser.runtime !== 'undefined');
+ } catch (e) {
+ // NOP
+ }
+ return (hasBrowser && !hasChrome);
+})()) {
+ chrome = browser;
+}
+
const yomichan = (() => {
class Yomichan extends EventDispatcher {
constructor() {