Question

We're working on a website. Our client want to check the website daily, but they're facing a problem. Whenever we make a change on the website, they have to clear their browser cache.

So I added the following header to my server configuration

Cache-Control: no-cache

As far as I see, firefox is receiving this header and I'm pretty sure that it is obeying it.

My question is, is this "Cache-Control: no-cache" guaranteed and does it work across all the browsers (including IEs)?

Was it helpful?

Solution

I find it's handy to use a "useless" version number in the requests. For example, instead of requesting script.js, request script.js?v=1.0

If you are generating your pages dynamically (PHP, etc) you can just keep the version number in a variable and only have to update it in one place whenever you update. If you want the content never to be cached, just use the output of time() as your version number.

EDIT: have you tried asking your client to change his browser caching settings? That way you can bypass the problem entirely

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top