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, andreas, basix, beidson, 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 |
Description
Krzysztof Jan Modras [:chrmod]
2020-01-24 05:27:20 PST
We're looking into ways to enable this. 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. 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 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. 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. 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. |