Firefox and IE deal with no-cache differently

I just spent a few hours debugging something that I finally tracked down to IE and Firefox dealing with HTTP caching differently. To make a very *long* story short (and believe me, this was a story of hours in Firebug and Fiddler and VS), IE does *not* cache HTTP pages if you send down the no-cache directive. Firefox does not cache HTTPS pages but *caches* HTTP responses even if you send down a no-cache. The fix is simple - send down a no-store directive instead. So instead of

Cache-Control	no-cache

you send down
Cache-Control   no-store

I eventually found a Bugzilla bug which deals with this exact scenario. It seems to be a contentious issue with different opinions on what the right behaviour should be. I'm just happy that I get to fix it with just a one-line code change :-)

Response.Cache.SetNoStore();

I'm putting it out there so that some poor soul in the future can save some time. :-)


Comments:
Here's a hack i use,to avoid caching in IE when making xhr calls from javascript.


dest='server.php?a=1&magic='+(new Date().getTime());
xhr.open("GET", dest, true);

Keep Clicking,
Bhasker V Kode
 
Hi Sriram,

I have tried in the following way because my request is https.

meta http-equiv="Cache-Control" content="no-store"

But still its not working. Do i need to use - meta https-equiv instead of - meta http-equiv. Or any other reason behind on this for not working.
Kindly suggest. Waiting for your your reply.
Regards
Kuttu
 
Thanks alot, the no-store solved my caching problem in firefox.
 
Siriam,thanks so much. I have been chasing my tail round and round with Firefox trying to get a C# .net page to expire (and thus refire the page logic) and yours has been the only reliable logic to work.
 
Post a Comment



<< Home

Archives

November 2004   January 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006   January 2007   February 2007   March 2007   April 2007   May 2007   June 2007   July 2007   August 2007   September 2007   October 2007   December 2007   January 2008   February 2008   March 2008   April 2008   May 2008