Service worker support is currently available in Safari, but not in Apple's webview component available to developers called
But is kind of changing, and I believe the answer is "apps web browsers" may now enable the Service Worker entitlement, but other apps using
WKWebView are still not allowed to.
This is not plainly stated anywhere, here are a bunch of tweets I am using as my basis for understanding, but I'm curious if anybody understands this better than I do.
Thomas SteinerOn iOS 14, `WKWebView` will get service worker support. 🎉 This means all third-party browsers like @GoogleChrome for iOS or @firefox for iOS will have access to this powerful API! It’s still the @WebKit engine under the hood, not Blink or Gecko. twitter.com/othermaciej/st…06:48 AM - 24 Jun 2020othermaciej @othermaciej@pes10k @johnwilander Good news! You’ve probably heard that iOS users will be able to change the system default browser. This will require an entitlement, process to be documented soon. That same entitlement will grant access to Service Workers.
othermaciej@othermaciej@tomayac @googlechrome @firefox @webkit To be clear, not all WKWebViews! But it’s more than just web browsers with an entitlement. More in a WWDC session later this week.07:01 AM - 24 Jun 2020
Michi Huber@michihuber@othermaciej @tomayac @googlechrome @firefox @webkit Which session was this covered in? Did not see it mentioned in the WKWebView session. Any pointers much appreciated!08:14 AM - 05 Aug 2020
othermaciej@othermaciej@michihuber @tomayac @googlechrome @firefox @webkit It wasn't! I was confused. We've now announced support for apps with the new default browser entitlement. I'll post when there's more to share.08:16 AM - 05 Aug 2020
Thomas Steiner@othermaciej @michihuber @googlechrome @firefox @webkit Maciej has posted about this only yesterday, it (unfortunately) wasn’t covered in the WWDC sessions: twitter.com/othermaciej/st…08:17 AM - 05 Aug 2020othermaciej @othermaciejThe rules and review process for iOS default email client and default browser are now published. Also documents the capabilities that come with the default browser entitlement, including support for Service Workers. https://t.co/Mx1US6zSpq
Kevin Kelchen@kevinkelchen@othermaciej Out of curiosity, could this mean that non-browser apps that use WKWebView (like a hybrid app) use Service Workers if they have the entitlement? Could the entitlement be granted for that use case?
Thanks! 🙂22:25 PM - 04 Aug 2020
othermaciej@othermaciej@KevinKelchen We know there's interest in this. Not part of this announcement.23:15 PM - 04 Aug 2020
Top comments (1)
From that same thread it seems promising to hear that by opting in to App-Bound domains developers will get access to the Service Worker support in their
WKWebViews, without having to apply for the browser entitlement.
I'm torn between feeling good/bad about this. My "good" comes from (1) the improved privacy for users and (2) there's a way developers can get service worker support without the need for the entitlement (which Apple is notoriously picky in approving other similar entitlements).
On the "bad" side for me it feels like they're holding back features as hostage in exchange for privacy compliance in a rigid way (how App-Bound domains work). Also, apps that push the envelope and don't exactly fit any of these scenarios are left in a limbo, either trying to get approval for their entitlement or balancing performance features with app capabilities.
Service workers in combination with the powerful WebKit API do open up a big surface area for intrusive/malicious practices, definitely not an easy area to secure so I understand their choices even without fully embracing them 😄