Tuesday, December 30, 2014

Re: how not to cache background image?

The image must not be loaded on every access! I only want to force a reload when I change it, not on every request.

Cache-Control: public, max-age=0, must-revalidate 

is exactly this. "public" means the resource is generally cacheable. "max-age=0" means that the cached resource will be marked stale immediately after it has been cached, "must-revalidate" means the browser/cache needs to make a request to your server to figure out if the content has changed in case the resource is marked stale. If new content is available it will be loaded, otherwise the cached resource will be used (and immediately marked stale again because of max-age=0 so the next time the browser/cache needs to revalidate again).

I think from an RFC point of view that is the same as Cache-Control: no-cache however some browsers seem to treat "no-cache" as literally "do not cache that file at all" instead of "cache it but always revalidate its content".

See chapter 14.9 and the following: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment