aboutsummaryrefslogtreecommitdiff
path: root/common/is_background.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'common/is_background.mjs')
-rw-r--r--common/is_background.mjs17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/is_background.mjs b/common/is_background.mjs
new file mode 100644
index 0000000..ef728a7
--- /dev/null
+++ b/common/is_background.mjs
@@ -0,0 +1,17 @@
+/**
+* Myext programmatic check of where the script is being run
+*
+* Copyright (C) 2021 Wojtek Kosior
+*
+* Dual-licensed under:
+* - 0BSD license
+* - GPLv3 or (at your option) any later version
+*/
+
+/* This needs to be changed if we ever modify the html file path. */
+
+export default function is_background()
+{
+ return window.location.protocol === "moz-extension:" &&
+ window.location.pathname === "/background/background.html";
+}