Service Worker - Browser support

Viewed 1132

CanIUse and MDN doesn;t seems to be agree on the support for service worker. In the midst of Chrome going to remove support for appcach, we are trying to ascertain the impact of moving to Service Worker. Are we reading the above two pages incorrectly?

We tried Google's own samples against device/browser combinations and results wore not encouraging. For example the 'custom offline page' demo failed in iOS Chrome (v80) where it worked in iOS Safari (12.4.5).

The 'Selective caching' and 'Read through caching' pages clearly show "service worker is not supported in the current browser" in Chrome 80. It is checking the if ('serviceWorker' in navigator) {, but other samples doesn't show such a message.

All and all it is confusing on the browser support for the Service worker. Is there there a universally tested sample which we can use as a benchmark for different device/browser combination.

Can I use browser support

2 Answers

I asked Jake Archibald of Google on this and he replied with the following SO post which must be still valid.

Chrome Service Worker iOS Support

Therefore apparently Safari is the only option at the moment. I am still wondering what Google is recommending developers to use once they remove support for AppCache.

Jake continued saying there is no way they can add support as Apple is not giving them full rights on iOS. But he mentioned appcache will continue to work as usual. His exact words are

"However, since Chrome on iOS is just a skin over Safari, appcache will continue to work while it works in Safari webview."

on iOS only Safari supports service workers. You can test browsers if it supports with this code

if ('serviceWorker' in navigator) { /*supported*/  }
Related