Send a message from my website to my extension background page

My website and extension are cooperating in such a way that I need to send a message from my website (not content-script) to my background script. In Chrome, this could be achieved via
    // some message

and then in manifest.json I declare the externally_connectable attribute, which is not supported by Firefox.

There doesn’t seem to be a way to do this with WebExtensions.

Any advice from anyone?

Looks like in Firefox it will (unfortunately) need a content-script intermediary.

Until is resolved you will indeed need a content script to interact with pages.

1 Like

Is there a way to pass message back to web page from extension.?

You can use postMessage to communicate with webpage (from your content script):

window.postMessage({type: "do_something"}, "");
1 Like