Bug 206741
| Summary: | WKWebView support for Service Workers | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Krzysztof Jan Modras [:chrmod] <krzysztof.modras> |
| Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | achristensen, ajuma, alexandros.sidiras, andreas, baena.francisco, basix, beidson, bill, costan, jason.jeffrey, krzysztof.modras, landsman, mjs, nathan_wild, tomac, tristan.morris, webkit-bug-importer, webkit |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | iPhone / iPad | ||
| OS: | All | ||
Krzysztof Jan Modras [:chrmod]
iOS version of Safari has some service workers capabilities. Yet WKWebView does not implement any of those.
Is there a plan to enable service workers or a way to contribute to make it happen?
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/59584040>
Maciej Stachowiak
We're looking into ways to enable this.
Victor Costan
The lack of Service Workers support in third-party browsers on iOS is hurting Chrome's AppCache removal efforts. AppCache is owned and will hopefully be removed by my team, and we would appreciate having Service Workers be available to all iOS browsers.
You can see a developer complaint at https://crbug.com/582750#c54.
My light searching turned up https://bugs.webkit.org/show_bug.cgi?id=182865, which suggests that WKWebView gates SW support on the com.apple.developer.WebKit.ServiceWorkers entitlement. I'm told that the entitlement is not available in the app console.
Sung Jeon
Any updates on this issue? If the tweet by Maciej Stachowiak [1] is a valid solution, I think this issue can be closed by documenting that Service Workers would only work with App-Bound Domains.
[1]: https://twitter.com/othermaciej/status/1295434201865412608
tristan-morris
Trialling this today with AppBoundDomains set, navigator.serviceWorker is exposed. But workers can only be loaded via HTTP or HTTPS protocols.
Workers can't be loaded from a custom URL scheme (at least if set via setURLSchemeHandler - https://developer.apple.com/documentation/webkit/wkwebviewconfiguration).
Ideally it would be possible to load workers from customproto://localhost/service-worker.js for example.
Nathan Wild
Is there an intention in the future to make this work with custom URL schemes for loading/registering the service worker?
There's a known limitation right now with apps that are solely built on wrappers creating a WKWebView to display their content (Cordova, Capacitor etc.) that service workers aren't a possible solution for handling offline content, passing authorization headers etc. on known requests.
For example, Capacitor uses its own custom URL scheme (capacitor://) to serve content as http/https are reserved for remote content, this alone would prevent service workers from being used as they would need to be served under that protocol instead, see https://github.com/ionic-team/capacitor/issues/7069.
Michal
Guys, please consider to enable this feature. Without it, the use of the web application within the web view is limited. For example, if you want to manage file uploads.
Francisco Baena
Is there any update about supporting custom
Francisco Baena
(In reply to baena.francisco from comment #8)
> Is there any update about supporting custom
... URL schemes/protocol to register Service Workers?
alexandros.sidiras
Capacitor and Cordova apps use custom schemes in iOS (capacitor://localhost and ionic://localhost to serve the web apps).
It would be amazing to let those apps benefit from a service worker for runtime caching, preloading, background-sync and other Workbox utilities.