View Single Post
  #22 (permalink)  
Old 02-18-2008, 10:10 PM
prasannavigneshr prasannavigneshr is offline
D-Web Incredible
 
Join Date: Feb 2007
Posts: 1,321
prasannavigneshr is on a distinguished road
Send a message via MSN to prasannavigneshr
Thumbs up ColdFusion Tips & Tricks - Forcing the browser not to cache a document

Forcing the browser not to cache a document


If you have a page that seems to be caching via the browser and can't explain why, try adding the following lines of code inside the <head></head> block of your HTML:
Code:
<META HTTP-EQUIV="expires" CONTENT="Fri, 1 Jan 1990 00:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="cache-control" VALUE="no-cache, no-store, must-revalidate">
I've encounted this when I use a form to call another Cold Fusion program that performs file/database updates and then uses CFLOCATION to redirect back to the calling program.

This will solve the cache problem in Netscape, however, Internet Explorer is a different story. If you are using IE 3.xx, the only way to get out of the caching problem is to either upgrade to IE4 or to get rid of the frames. See KB article Q176797 for more information. If you are using IE4, you actually have to add a 2nd <head></head> block at the end of your html code, after the </body> tag but before the </html> tag. In this case, you only need to duplicate the Pragma=no-cache tag.

Code:
 <HTML>
    <HEAD>

        <META HTTP-EQUIV="REFRESH" CONTENT="5">
        <TITLE> Pragma No-cache </TITLE>

    </HEAD>
    <BODY>

        This is an example of where to place the second header section<br>
        so that the "Pragama, No-Cache" metatag will work as it is supposed to.<br>

    </BODY>
    <HEAD>

        <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

    </HEAD>
    </HTML>
__________________
Prasanna Vignesh
MCPD | Web Developer
Reply With Quote