I need a website to cache data. And have set up both Cache Storage (via Service Worker) and Application Cache (via html manifest attribute). They work.
Question I have is to: how to ignore the Application Cache in case Server worker support exists on the browser?
Some reading on the internet suggests that Chrome ignores Application Cache if Cache storage works. I find it does not. Chrome 63 on Mac OS X.
One option seems to be to create a dynamic page (either keeping the manifest attribute or not) on the server based on the browser and OS type. Is there a better way? Thanks
Once a service worker has activated, any existing Application Cache instances for the client pages that it controls are automatically unassociated. This behavior is described in step 6 of the Activate algorithm in the service worker specification:
For each service worker client client whose creation URL matches registration’s scope url:
If client is a window client, unassociate client’s responsible document from its application cache, if it has one.
Else if client is a shared worker client, unassociate client’s global object from its application cache, if it has one.
If you're not seeing that behavior, and you're sure that the service worker activated and has control over a given client window, then that sounds like a bug in a browsers' implementation. You should follow up with details on reproduction steps on the appropriate browser's bug tracker.