How does browser work with expiration headers, cache-control headers, last-modified-header?

Umair Jabbar picture Umair Jabbar · Apr 22, 2010 · Viewed 8.9k times · Source

I am a web developer, have worked with PHP and .NET both. having over a year of experience working on web I haven't been able to understand the browser caching features thoroughly, I hope Web Gurus here can help me with it. Questions I have in my mind are:

  • How does browser actually caches stuff, does it request for to see if the cached file has changed on the server or not,
  • What is the Ideal way for a developer to make use of browser caching to its full, but also to be able to push new changes on the site with no hassle at all. I think if browser somehow caches my CSS and JS and Images, and then just makes a checks for their modification to the server every time, this can sort the issue. but I am not sure how to do it.

Answer

HttpWatchSupport picture HttpWatchSupport · Apr 22, 2010

This blog post may help:

http://blog.httpwatch.com/2007/12/10/two-simple-rules-for-http-caching/

It explains how to use of caching, whilst maintaining the ability to make changes when required.