I'm looking for a solution to a recurring problem I have with form based search results in my application.
Basically when a user searches using an HTML form and I display the results from the Database on the next page, this works perfectly.
However, when a user clicks on an individual record in the result set and then clicks "Back" on the browser, the browser asks (Firefox):
"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."
To give an example, a form to search a DVD collection, user searches by year, clicks on an individual movie. When the user clicks back to the search results page I don't want the user to have to resubmit/resend that form data.
So does anyone have an idea of how to get around this?
To give you some more information I am using the POST method to submit the form and am using the following headers to stop the browser from caching the page.
Header('Pragma: no-cache');
Header("Cache-control: private, no-cache, no-store");
Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");.
As most of the site is password protected, I don't want the password protected side cached and be able to be brought back up after login.
Essentially what is the best way to avoid this type of browser behavior and what is the cause? Is no-cache the culprit? Should I specify an Expire time of a couple of minutes in the future from page load on the search results page?
What is the best way of approaching this as I don't see this problem on other sites. Am I going about the no-cache part all wrong?