0

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

tim peterson
  • 23,653
  • 59
  • 177
  • 299
  • 1
    The only way for the browser to check contents is for it to download a new copy of the file, therefore refreshing the cache. – Blender Jun 21 '12 at 02:16

1 Answers1

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

ccleve
  • 15,239
  • 27
  • 91
  • 157
  • -@user237815, thanks for your answer, one last question: how does setting or not the expires headers fit in with this to download or not decision tree? – tim peterson Jun 21 '12 at 02:37
  • 1
    Good question. I do not know about the interaction of the expires header and if-modified-since. The spec is here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21 – ccleve Jun 21 '12 at 02:49