JavaRanch Home
 
Front Page FAQs Ranchers Categories Recent Changes To Do Upload

No Cache Headers   



While the browsers usually have a mind of their own, the following hints added to the response header seem to prevent most modern browsers from pulling pages out of cache when the same URL is "hit".

   response.setHeader( "Pragma", "no-cache" );
   response.setHeader( "Cache-Control", "no-cache" );
   response.setDateHeader( "Expires", 0 );

The same effect can be achieved by using meta tags in the HTML header:

 <meta http-equiv="Pragma" content="no-cache">
 <meta http-equiv="Cache-Control" content="no-cache">
 <meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">

The Cache-Control header was added in HTTP 1.1, while the other two were also present in HTTP 1.0.



Back to:

ServletsFaq

JspFaq

Front Page FAQs Ranchers Categories Recent Changes To Do Upload
Last Edited: 02 August 2006 What's Changed?
 
Copyright © 1998-2008 Paul Wheaton | Home | Contact Us | Privacy | Register