-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I send&receive messages from a new popped up window? #12
Comments
@zgayjjf any update? Did u find any solution? |
It should allow to return some custom type from method: getBackgroundPageType which behaves same as options or popup. https://github.com/zikaari/webext-bridge/blob/main/src/utils.ts#L21-L38 |
Would you elaborate a bit -- not following exactly :) Edit: Reading that utility, seems like it would return @antfu @zikaari it would seem that the |
Ah, here we go. I need to also check for diff --git a/node_modules/webext-bridge/dist/index.mjs b/node_modules/webext-bridge/dist/index.mjs
index 55f1afc..c9231a3 100644
--- a/node_modules/webext-bridge/dist/index.mjs
+++ b/node_modules/webext-bridge/dist/index.mjs
@@ -27,7 +27,7 @@ var getBackgroundPageType = () => {
const popupPage = ((_a = manifest.browser_action) == null ? void 0 : _a.default_popup) || ((_b = manifest.action) == null ? void 0 : _b.default_popup);
if (popupPage) {
const url = new URL(browser.runtime.getURL(popupPage));
- if (url.pathname === window.location.pathname)
+ if (url.pathname === window.location.pathname || window.location.pathname === '/notification/index.html')
return "popup";
}
if ((_c = manifest.options_ui) == null ? void 0 : _c.page) {
@@ -40,6 +40,7 @@ var getBackgroundPageType = () => { |
Yeah exactly. So I m suggesting to make it generic e.g. allow some 'xyz' folder i.e. if the pages are in 'xyz' then the context should be treated as 'options' |
I'm using webext-bridge in a new project.
However, I can't receive a response when I use
sendMessage
in a window opened by the code below.It is the same even if I called
allowWindowMessaging
in content-script andsetNamespace
in the created window.Did I miss something?
The text was updated successfully, but these errors were encountered: