[mod_python] Detecting Back Button Usage

Clodoaldo clodoaldo.pinto.neto at gmail.com
Tue Mar 20 09:03:05 EST 2007

2007/3/20, Kenneth Loafman <kenneth at loafman.com>:
> I'm using mod_python under Ubuntu Edgy 64, doing some basic plots of
> data and allowing users to select a point to center on a region and gen
> the next plot.  All of that works as long as the user moves forward.
> The problem comes in the use of the back button.  The browser merely
> displays the last page rather than rebuilding it, or at least restoring
> the variables.  This leads to a lot of confusion because the server is
> on one set of plot values and the browser is now on another.  This seems
> to be a common problem.  Is there a solution, or should I just warn the
> user not to use the browser back button?

How does the user select the point? Entering it in a form field? If so
save the plot values (the page state) on the page using a hidden field
inside the form:
<input type="hidden" name="variable_1" value="99.9">
<input type="hidden" name="variable_2" value="33.3">

When the form is submitted those values will be available to your script.

If you are using some Ajax scripting to let the user select the point
then adapt it to also send the current page state.

I could not find the correct words to google. It would be something
like "page state maintenance in HTML (or HTTP)". Can someone create
the correct search words?

Clodoaldo Pinto Neto

More information about the Mod_python mailing list