aboutsummaryrefslogtreecommitdiff
path: root/common/browser.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/browser.js')
-rw-r--r--common/browser.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/common/browser.js b/common/browser.js
new file mode 100644
index 0000000..1d9edda
--- /dev/null
+++ b/common/browser.js
@@ -0,0 +1,27 @@
+/**
+* Myext WebExtension API access normalization
+*
+* Copyright (C) 2021 Wojtek Kosior
+*
+* Dual-licensed under:
+* - 0BSD license
+* - GPLv3 or (at your option) any later version
+*/
+
+"use strict";
+
+/*
+ * This module normalizes access to WebExtension apis between
+ * chrome-based and firefox-based browsers.
+ */
+
+(() => {
+ if (window.browser === undefined) {
+ window.browser = window.chrome;
+ window.is_chrome = true;
+ window.is_mozilla = false;
+ } else {
+ window.is_chrome = false;
+ window.is_mozilla = true;
+ }
+})();