Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Cache-API not possible in Safari/Chrome on IOS, is that correct?

Question

Can I or can I not use caching API with service workers on IOS in either Safari or Chrome as of IOS 13.1?

Background

I have a web app, that is to be used offline.

I use:

  • Serviceworker
  • Cache API
  • IndexedDB

Chrome dev tools screenshot

Works in Chrome on Windows/Android

Works as expected.

Does not work when offline on IOS

However, on IOS (13.1+), if you try to refresh (click refresh in browser) an html file when offline, the cache does not seem to work (you get the standard page not found error). This goes for Chrome as well as Safari.

Confusing information about caching API on IOS Safari

According to CanIUse, the caching API is not supported in Safari latest, which would explain the behaviour. I was not able to find information about Chrome for IOS support for cache, but I would guess it is not supported, if not in Safari.

I have found several sources that say caching API is supported in IOS Safari, so I am pretty confused.

Question again

Can I or can I not use caching API with service workers on IOS in either Safari or Chrome as of IOS 13.1?

I have deliberately not included any code examples, as the question is general and depends on whether the feature is supported in IOS Safari/Chrome or not. If it is possible to use the caching api, but I somehow implemented it wrong in code, that is for another specific post.

like image 845
Kjensen Avatar asked Oct 02 '19 11:10

Kjensen


1 Answers

According to https://developer.mozilla.org/en-US/docs/Web/API/Cache#Browser_compatibility cacheapi should be supported in desktop safari not in mobile. I found this post https://webkit.org/blog/8090/workers-at-your-service/ check the bottom they are waiting for your feedback :)

And for chrome according to https://chromestatus.com/feature/6461631328419840 it suppose to work. you can find who is responsible of the cache api in chrome and file a bug from that page.

over all I should say cache api looks like not used very much. because there is not much detailed posts on the topic.

like image 189
ozkanpakdil Avatar answered Oct 17 '22 20:10

ozkanpakdil