Messaging between background and content scripts

There are 2 sendMessage functions in Chrome API.

So, to send a message TO a content script, you need to use chrome.tabs . To send a message FROM a content script (or within the extension pages), you need to use chrome.runtime .

The event is chrome.runtime.onMessage in both cases.

See Messaging docs for more details.

1 лайк