chrome.runtime.sendmessage extension id not working

Viewed 19

I have a very weird problem on Chrome.

The document says the first argument should be a Chrome extension ID.

chrome.runtime.sendMessage('bgmpeololjflcbghnmfkfldminickkog', { text: "hogee." })

Something like the above, right?

When I run

chrome.runtime.sendMessage('bgmpeololjflcbghnmfkfldminickkog', { text: "hogee." })

or

chrome.runtime.sendMessage({ text: "hogee." })

on the extension context, let's say my-extension context on the console, it works.

But when I run the above two lines on the top context (the page context), the first line one doesn't work, and the second line one doesn't work w/ an error.

Ofc I'm making sure the extension id is correct. On the my-extenson context, chrome.runtime.id then I get the id bgmpeololjflcbghnmfkfldminickkog.

I'm confused, no idea what's wrong (or not wrong, is it a bug?) here.

0 Answers
Related