admin管理员组文章数量:1404624
I have an iOS application that contains Safari Web Extension that uses Declarative Network Request for content filtering. I'd like to have a toggle in the iOS app that disables or enables the whole Web Extension. How can i do it?
Originally I was going to send a message from containing iOS app to the background script to enable/disable according rulesets. But the messaging API to the background script from the app is available on macOS only, not on iOS:
You can’t send messages from a containing iOS app to your web extension’s JavaScript scripts.
I wonder how can I change the settings and let background script know it needs to apply them.
I have an iOS application that contains Safari Web Extension that uses Declarative Network Request for content filtering. I'd like to have a toggle in the iOS app that disables or enables the whole Web Extension. How can i do it?
Originally I was going to send a message from containing iOS app to the background script to enable/disable according rulesets. But the messaging API to the background script from the app is available on macOS only, not on iOS:
You can’t send messages from a containing iOS app to your web extension’s JavaScript scripts.
I wonder how can I change the settings and let background script know it needs to apply them.
Share Improve this question asked Mar 10 at 16:41 4ntoine4ntoine 20.5k25 gold badges113 silver badges239 bronze badges 01 Answer
Reset to default -1You can use an App Group to share data between your native app and your app extension. The app extension can communicate with your extension's background script.
One approach:
- The user makes changes in your iOS app
- The app saves this data in a
UserDefaults
suite - The background script requests setting values from your app extension at the appropriate time; for example your background script could request the data in an
onBeforeNavigate
handler. - Your app extension loads the defaults from the shared suite and provides this data to the background script.
本文标签: iosHow to enabledisable Safari Web Extension from the containing appStack Overflow
版权声明:本文标题:ios - How to enabledisable Safari Web Extension from the containing app? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744834637a2627558.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论