Looks like it works well on Content Scripts, however, it doesn't work in extension pages embedded in iframes.
I have an html page (that lives inside the extension) that I inject in the target page inside an iframe. The browser.storage.local.onChanged.addListener is never triggered in that page.
Note: This works in Chrome, Firefox, Edge, and Opera.
It looks something like this:
<!-- Target page -->
<body>
<iframe src="safari-web-extension://<ID>/my-page.html">
<html>
<script type="text/javascript">
chrome.storage.local.onChanged.addListener((details) => {
// Is never triggered
console.log(details)
})
</script>
</html>
</iframe>
</body>
Had to fallback to polling only for Safari.
It'd be good to know if this is a permissions issue or an actual bug in Safari.
Topic:
Safari & Web
SubTopic:
General
Tags: