'sendMessage not received by options page onMessage in Safari
I have ported a Chrome/FireFox extension. One of the things that does not work is receiving message from background to a options page (safari-web-extension:///page.html)
I dont get a error message or any details back from the promise. Any idea where this goes wrong?
Background:
browser.tabs.sendMessage(tab.id, { message });
Options page:
browser.runtime.onMessage.addListener(message => {
console.log(message);
});
Solution 1:[1]
Much better to use the long lived connections ports
Solution 2:[2]
It looks like safari-web-extension
pages receive background script messages but they don't seem to receive messages that are sent via chrome.tabs.sendMessage
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ziv Adler |
Solution 2 | Bret |