kiwix-apple
kiwix-apple copied to clipboard
Support ZIM files with service workers in Kiwix for iOS
New ZIMit based ZIM file use service workers.
TLDR: I don't think this is really possible right now.
In iOS 14, browser apps can become the default browser by using com.apple.developer.web-browser
entitlement. (e.g. use Firefox as the default browser on iPhone) This AFAIK is the only way to have WkWebView
support service workers right now.
Kiwix is not a generic purpose internet browser and cannot use this entitlement (I can positively say the app will be rejected if we do it), therefore there doesn't seem to be a way to support this request
See apple doc for more: link
I have the same analysis. Kiwix is not a Web browser, therefore not concerned by the current "web browser app" approach.
This post is of interest as well https://dev.to/ben/will-ios-14-support-service-workers-in-wkwebview-5gn.
That said, the situation is evolving and it seems possible that WKWebView will support serive workers in the future.
For the moment, I believe this is important to ignore entries with the tag _sw:yes
.
We will then re-evaluate the situation in a year.
ignore entries with the tag _sw:yes
Just to be clear: you mean not to show these files in the library right? What happens if user open such a file with kiwix?
Yes this is what I mean. If open locally, the. The zim will display an error because it can itself detect that SW are not supported.
What happens if user try to manually open such a file?
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
Not sure, but a message should be displayed that to be displayed this ZIM file needs service workers and this is not available.
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
This ticket should better be updated because two years have passed.
Couldn't find a definitive answer online. Seems like it's available for app-bound-domains (a selection of up to 10 static domains you declare in the app) but I could not find any information regarding custom url scheme and service workers with WKWebView. Should probably be tested but lack of information online might demonstrate a lack of interest
Do you think Mac Os has the same limitation as iOS? Do you have more alternatives than WKWebView?
Can we expect an update here in the following months? Would be highly appreciated if Zimit files would work on iOS and macOS soon.
@rgaudin I have seen https://github.com/ionic-team/capacitor/issues/4122 which seems to confirm that SW are available for app-bounds-domain. That means that we could use such a bound-domain to allow SW:
- Either via a custom protocol handler (but SW has to work in that context)
- OR like we do on Kiwix for Android with our fake domain
kiwix.app
Both needs to be tested as it's not guaranteed that it would be allowed
- We're not sure if SW would work with custom schemes. Security Context is HTTP specific
- We're not sure it it there's a mechanism similar to Andoid for intercepting requests
shouldInterceptRequest
and it it's as relaxed: we declare being on an HTTPS URL but we intercept/forge all requests (secure context here is not real)
It seems that we will be able to create ZIM files without SW with Zimit in version 2.0. Therefore this feature request priority is significantly lowered.
Closing as this won’t be necessary anymore once zimit2 will be released.