Safari 15.4 Release Notes shows that webpage-to-extension messaging using externally_connectable is supported.
https://developer.apple.com/documentation/safari-release-notes/safari-15_4-release-notes
However, when I tried testing it, I was not really able to get it to work. What I have tried:
Added matches array to the externally_connectable object in manifest.json
Obtain the extensionID using browser.runtime.id
Added listener to onMessageExternal for extension
Send a message from a webpage, that is in the matches array, using chrome.runtime.sendMessage with the extensionID obtained above
With these steps, I wasn't able to receive a message sending to the extension. I am not sure if the extensionID is wrong or if I am missing any crucial steps. Can someone please recommend what I should try?