Skip to main content
February 26, 2010
Answered

Old variable value if back button is pressed

  • February 26, 2010
  • 2 replies
  • 918 views

Hi,

first of all I hope to provide a clear explanation of the problem I'm dealing with, if not I apologize.

In my fantasy football website I enable users to change only one player from their roster on a weekly basis.

No problem with that: once the new player has been selected, the change is made and the user gets sent to a page confirming that everything went right.

The new roster is shown updated if the user clicks on the "roster" link on the main menu.

A problem arises if the user pushes the browser's back button instead, since the form which enables roster changes becomes available again (and I'll somehow have to make sure that it doesn't), but most of all, if the user presses back again, the page with the original roster is shown, i.e. displaying the player just dropped instead of the newly acquired one.

I guess something must be added at the beginning of the page showing the roster, but I wonder what sort of check it should perform.

Any suggestions ? Do I have to provide code ?

Thank you

Giovanni

This topic has been closed for replies.
Correct answer Dan_Bracuk

Pages are cached by default.  The following three commands will make them not cache.

<CFHEADER NAME="Cache-Control" VALUE="no-cache, no-store, must-revalidate">
<CFHEADER NAME="Pragma" VALUE="no-cache">
<CFHEADER NAME="Expires" VALUE="-1">

We do this so often we made a custom tag with those three commands.

2 replies

Inspiring
March 16, 2010

Hmmm... ... I remember that there is something about using redirects that will zap the "back" linkages.  But I cannot for the life of me remember what it was ...

ilssac
Inspiring
March 16, 2010

TLC-IT wrote:

Hmmm... ... I remember that there is something about using redirects that will zap the "back" linkages.  But I cannot for the life of me remember what it was ...

It's not that redirects zap the back linkages, but that they are part of the back history chain.  Thus you hit the back button return to the redirect URL which again redirects you to the page you just tried to leave with the back button, causing an endless loop, unlsss the user manages to skip over the redirect item in the back history.

Inspiring
February 26, 2010

Don't cache the pages.

March 2, 2010

Thanks for replying, but I haven't solved the problem yet.

Are pages cached by default ? I'm asking since I didn't do anything to cache them.

I looked the caching subject up on the CF documentation but couldn't come out with a solution: does it have to do with using the cfflush tag maybe ?

Thanks

Giovanni

Dan_BracukCorrect answer
Inspiring
March 2, 2010

Pages are cached by default.  The following three commands will make them not cache.

<CFHEADER NAME="Cache-Control" VALUE="no-cache, no-store, must-revalidate">
<CFHEADER NAME="Pragma" VALUE="no-cache">
<CFHEADER NAME="Expires" VALUE="-1">

We do this so often we made a custom tag with those three commands.