I am a bit confused with regards to availability of Caches API on mobile devices.
https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage
Documentation states this API is available on both service worker scope and window scope.
I can clearly access it on desktop's Chrome without issues.
Now whenever I do feature detection on Android's Chrome I get undefined as if feature is not available.
I tried to detect this way:
if ('caches' in window)...
if ('caches' in self)...
calling from console log via connected device etc
What do I miss?
PS: I understand Safari has very basic implementation so I expected this to go wrong with Safari, but here I am testing it with Chrome on Android;/
It seems window.caches
(CacheStorage) is only available on chrome mobile when the page is served through SSL.
I'm testing with my Progressive Web App (PWA), containing a Service-Worker for caching and a manifest file.
When serving the PWA via HTTP over the LAN window.caches
is not available.
When served via a domain-name with SSL enabled, window.caches
is available and behaves like on the Desktop-Version of chrome.
It doesn't make a difference, whether you run it in a browser tab or standalone (when added to home-screen).
Edit: In fact, the same behavior also applies to chrome on desktop. Caching on my app was working only, because i tested with 'localhost' or 127.0.0.1. On any other domain / ip-address, caching gets denied when not using ssl.