feat: Implement App-Bound Domains to enable Service Workers in WKWebView on iOS14+
See original GitHub issueFeature Request
Description
Since iOS14, it’s possible to make service workers works in WKWebView by providing a list of trusted domains (up to 10).
These domains then gain support for service workers, which is invaluable for us as we plan to use server.url
in production to distribute our PWA on iOS.
Here are links describing the possibilities and features :
Platform(s)
- iOS
Preferred Solution
I think being able to pass the domain list with capacitor’s config file would be enough. Then capacitor could patch the Info.plist
file with the domains, and build the WKWebView using the snippet provided in the first post I shared above :
let configuration = WKWebViewConfiguration()
configuration.limitsNavigationsToAppBoundDomains = true
// Create a WebView with this configuration
Alternatives
As of today I don’t think there is any alternative to support service workers in WKWebView
Additional Context
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
App-Bound Domains - WebKit
Many applications use WKWebView as a convenient way to display websites ... The App-Bound Domains feature takes steps to preserve user ...
Read more >Will the AppStore accept apps rend… | Apple Developer Forums
In my testing over the first iOS/iPad14 beta, I've found that WKWebView with App-Bound Domains enabled, supports the Service Workers API on the...
Read more >Service Workers unavailable in WKWebView in iOS 11.3
Service Workers in WKWebView now require an entitlement: com.apple.developer.WebKit. ... A better solution might be using App Bound Domains.
Read more >Will iOS 14 support service workers in WKWebView?
But is kind of changing, and I believe the answer is "apps web browsers" may now enable the Service Worker entitlement, but other...
Read more >Safari on iOS 14 and iPadOS 14 for PWA and Web Developers
Hello Service Worker #. Thanks to App-Bound Domains, browser apps with the browser entitlement will have app-bound domains enabled for the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI, Ian no longer works at Ionic so he probably won’t answer 😄. To answer your question, here’s why we do not advise using a live
server.url
:server.url
option.Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.