SimB4
SimB4

Reputation: 162

WKWebView analog of service worker

I'm trying to implement part of app with PWA approach, that works fine on Android, but not for iOS. We need to have

As were mentioned here service workers are not supported within WKWebView (or UIWebView). So is there analog or alternative solution like smart cache control?

Seems like it is possible to store some web content from app and be able to update it if something changes. May there is already a framework/library/approach for that purpose?

EDIT Service Workers unavailable in WKWebView in iOS 11.3 - this question explains the status of ServiceWorkers in WKWebView, but no alternative is given. I would like to discuss any alternative solutions.

One thing I discovered is https://github.com/xtools-at/iOS-PWA-Wrapper. It looks like working based on AppCache, but https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache#Browser_compatibility says it is deprecated and adviced to use SW instead (which is not an option for PWA).

Upvotes: 9

Views: 5926

Answers (1)

SimB4
SimB4

Reputation: 162

So before WKWebView get service-workers to work, you can use AppCache (not yet fully deprecated). You can use this and take a look at source page at https://leasingrechnen.at What they do? In case if there is no service worker in browser, they load iframe that points to a page with manifest.appcache file implemented, so the page is cached.

Upvotes: 3

Related Questions