Safari Web Extension does not load content script on iOS 15

The content scripts specified in the manifest of an extension should be loaded each time a user visits a web page. However, in the iOS 15 simulator, the content script is only loaded the first time that the extension is enabled -- either when you grant permission for the site, or if you turn the extension off and back on while on a site. Otherwise, the content script is not injected. This is clearly a bug, right? Is there a known workaround or a fix in the works?

I had this exact same issue for a while, you want to make sure the permissions are enabled on the website or the content script won't inject. I still had the issue at random times, but after updating to the beta 2 it was much more consistent.

I am seeing the same problem in Safari 14.1.2 for Big Sur.

It appears that content.js won't be injected into web pages that you have not given permission for. I am noticing that on iOS and macOS I have to go searching for a tiny yellow caution icon when permissions are set to 'Ask'. Selecting this caution icon, an alert-like box pops up asking to give permission for one day or permanently.

I could not find the injected scripts in the debugging tools Sources, until after I gave permission. Then mysteriously, the extension started working again.

Same problem... same diagnostic Works fine on simulator 15.2 Does not work correctly on iOS15.4

  • extension enabled
  • extension authorized for any url and allowed/always, except on the first page loaded after Safari is killed and restarted
  • content script won't load (and is clearly not loaded, since it's not even appearing in "sources" when you "remotely" check sources from Safari on Mac using Development tools)
  • background script is not called back on browser.webNavigation.onBeforeNavigate

I will probably file a bug report...

Warning in console (but there are so many warnings, who can say which one is significant):

errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

Safari Web Extension does not load content script on iOS 15
 
 
Q