1

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

1 Answer 1

0

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:

  1. If client is a window client, unassociate client’s responsible document from its application cache, if it has one.

  2. 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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Jeff. I did notice such a behaviour. But from your comments let me try it again step-by-step and confirm it. Also will share all details here. Thanks
I stand corrected @Jeff Posnick. Perhaps, the app cache was from an earlier settings. Thanks. Now a dual caching policy for both browser types will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.