I found underneath (scroll down a bit). Did not try yet
https://www.wwdcnotes.com/notes/wwdc22/10099/
Post
Replies
Boosts
Views
Activity
Weird, just tried out the above. I run code underneath, I always see "Received response from the background page" in the console but response is always undefined. Even in cases where I do not listen for messages from website in my background page.
browser.runtime.sendMessage(
extensionID,
{ greeting: "Hello!" },
function(response) {
console.log("Received response from the background page" );
console.log(response);
}
);
I managed to get the basic example to work. There were some errors on my side, but things were quit hard to debug. For example; there was an error in my background script that was not shown in the console log in safari web inspector. After clicking option-command-r (clear cache) the console alerted that there was an error in my background script and then displayed the error after which I could fix and the basic example worked! (Now I am going to try out some more complex information exchanges, let's hope for the best ;-)
@SafariLearner: I noticed that you mentioned "chrome.runtime.sendMessage" --> this should be "browser.runtime.sendMessage"