Force Firefox 3 to Refresh a Dynamic Page

Firefox has for a long time kept form variables in memory when the user clicked reload, or navigated away and then clicked the back button.  Filling hidden form fields with old data from the cache is a really bad idea if you ask me, and I needed to force a refresh.

Usually, I’d use the meta tags to tell the browser not to cache the page, but Firefox 3 seems to ignore them entirely, and will continue to cache and load from the cache.  Wonderful.

Solution for now is to set the following HTTP headers (seen here in ColdFusion code):

<cfheader name="Cache-Control" 
    value="max-age=0, no-cache, no-store, must-revalidate">
<cfheader name="Pragma" 
    value="no-cache">
<cfheader name="Expires" 
    value="Wed, 11 Jan 1984 05:00:00 GMT">

NB: The order of the headers seems to be important!  You can find a good discussion and test results on MozillaZine’s forums.

Posted in Technology and tagged .

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *