Here's a few suggestions:
This method id a bit hefty, but it's the technically correct method, and one of the few that AOL's proxies will pay attention to:
<CFSET gmt = gettimezoneinfo()>
<CFSET gmt = gmt.utcHourOffset>
<CFIF gmt EQ 0>
<CFSET gmt = "">
<CFELSEIF gmt GT 0>
<CFSET gmt = "+" & gmt >
</CFIF>
<CFHEADER NAME="Pragma" VALUE="no-cache">
<CFHEADER NAME="Cache-Control" VALUE="no-cache, must-revalidate">
<CFHEADER NAME="Last-Modified" VALUE="#DateFormat(now(), 'ddd, dd mmm yyyy')# #TimeFormat(now(), 'HH:mm:ss')# GMT#gmt#">
<CFHEADER NAME="Expires" VALUE="Mon, 26 Jul 1997 05:00:00 GMT">
Alternatively, in the flow of an application, you often need to return the user to a page that has already been displayed--but you've already passed new variables to the page so it will dynamically output something different this time. Since you don't want the user looking at the old page, you need to ensure that the page refreshes somehow and makes a call to the server again for reprocessing.
Most popular browsers (Internet Explorer and Netscape) cache pages already visited on the local machine. Then, when another call is made for it, the browser pulls up the local copy rather than make another call for the page. This can prove to be a problem under the circumstances described above, since the old page will be displayed to the user.
The key to creating a workaround for this situation is to know that browsers identify a page by its URL--if the URL is the same as the one it just cached locally, it uses the local copy. Accordingly, you can simply append a dynamically created variable name to the URL, thereby producing a new URL and forcing the browser to make a subsequent call to the server to retrieve the new, and up-to-date, page. Here is an example of the code you can use to do this:
<CFLOCATION URL="index.cfm?norefresh=#Rand()#">
Rand() returns a random number in the range of 0 to 1, including fractions, so the URL will be different each time you call it, which forces the browser to request the page again from the server. That, in turn, ensures the most current information will be displayed.
A third option is to use standard META tags
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=MyPage.cfm">
But, META tags are for people who have only static pages, and cannot create HTTP headers. That's why it's "HTTP-EQUIV". It tells the browser "Pretend that you got this HTTP header".
But we have ColdFusion. ColdFusion creates HTTP headers very nicely, using the CFHEADER tag. If you want to create an HTTP header, then do it, rather than relying on the browser handling the META tag properly.
Try this in the HEAD of a document:
<CFHEADER NAME="Expires" VALUE="Mon, 06 Jan 1990 00:00:01 GMT">
<CFHEADER NAME="Pragma" VALUE="no-cache">
<CFHEADER NAME="cache-control" VALUE="no-cache">
<!-- meta anti cache-->
[COLOR=000080]<META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">[/color]
[COLOR=000080]<META HTTP-EQUIV="Pragma" CONTENT="no-cache">[/color]
[COLOR=000080]<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">[/color]
- tleish