Question

Two general questions I'm wondering about both in the case for a given file(.js, .css, etc.) where you've set an expires header and also when you have not:

  1. Do browsers request a new file (NOT serving the cached one) only if the file name has changed? Browser's don't assess the file contents too, correct?

  2. Do ALL browsers behave the same regarding question #1 or are there known to be differences between them, for example on mobile (iOS safari, etc.)?

thank you, tim

Was it helpful?

Solution

  1. The browser can't check file contents unless it downloads the file. (The browser does not, for example, request a checksum). It usually delegates the task of content-checking (or timestamp-checking) to the server. The browser will send an if-modified-since header with a timestamp. The webserver will check to see if the file has changed, and if not, it will send a 304 not modified code.

  2. All browsers follow this basic protocol. Servers may vary in how they decide if a file has changed.

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