Service worker , iOS


#1

Hello everyone ,

I read that iOS does’nt support service worker (https://cloudfour.com/thinks/ios-doesnt-support-progressive-web-apps-so-what/) , but we can anyway develop a PWA using ionic without this.

In the case I need service worker in iOS to better cache data, handle push notifications, and run background tasks, I found this link : https://www.npmjs.com/package/cordova-plugin-service-worker
Is this actual? What are best practice to use service worker in iOS if they don’t exist natively ?

Regards,


#2

The browser platform, which would be required to get the Cordova plugin running in browser, is only semi supported in Ionic. Normally PWAs are built without Cordova support.

(Which doesn’t mean you could try and this might work - seems lots of people are using the browser platform for their PWAs)


#3

@Sejuan12

Thanks for reply.

But actually, it’s not mandatory to use service worker to developp a PWA with push notification and offline content ?

I can get this with https://docs.ionic.io/services/push/
https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59

And for offline content (or cache) => use ionic storage.

Or is there other practice?


#4

Push notifications are not available for PWAs on iOS yet as they are not supported by Safari.


#5

So, why does the ionic documentation say it’s compatible with ios? using Phonegap’s push plugin


#6

Because this is talking about native functionality in native apps built with Cordova.


#7

Oh yes, thanks for this point. I didn’t notice this still yet…

So if I want to use Notification and Offline Content etc… I use native functionality (which can be done with ionic ;-). And when iOS ( safari) will support PWAs , I will try it.

Do iOS already support some PWAs functionality ? Or nothing ? I don’t find good information about this.


#8

Some, more stuff was added with iOS 11.
Google for “ios pwa support” for more articles on that.


#9

Okay.
Thanks for all
Have a nice day