Please read my blog's comment policy here.
Some time ago, I wrote a summary of how Internet Explorer’s cache works. At the time, I left out mention of the two cache-control directives introduced by IE5: pre-check and post-check. These directives enable a “background update” mechanism where a cached resource is reused while simultaneously a background revalidation of the resource is performed, ensuring that any updates to the resource will be cached locally before the resource is reused a third time.
MSDN defines these directives as follows:
The (sadly grainy & typo-ridden) timeline from MSDN shows how this mechanism might be used:
As it turns out, there are few use-cases on today’s web where a site is willing to show the user potentially outdated content but also believes that it’s important enough to perform a background freshness check.
What’s worse is that, in my experience, no sites sending the post-check and pre-check directives are even using them properly. Watching in Fiddler, all use of these directives I’ve seen is as follows:
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0
Where exactly this bad pattern originally came from, I’m not sure, but it’s now replicated in many popular frameworks, and tons of sites send this header to try to forbid caching. If you want to prevent caching, don’t specify the post-check and pre-check directives at all. Doing so is completely unnecessary and results in wasted bandwidth and HTTP header processing cycles. In one of the IE7 betas, this pattern even resulted in a somewhat amusing and extremely frustrating bug.
A few other points about these directives:
If you’re using post-check and pre-check on your site, I’d love to hear from you. Thanks!
-Eric
Eric, that's a really interesting feature. Is this an IE only feature? I can't seem to find any official spec's or mentions of pre & post-check outside of MSDN. Few discussions on Mozilla related sites, but nothing conclusive.
@igrigorik: These were extension directives added by IE5. As far as I know, no non-WinINET-based browser supports them.
we are currently using this extension on http://www.romatoday.it (and the rest of the network)
it works like a charm, but unfortunatly only on IE.