Page 1 of 1
Can you resubmit automatically without need for refresh?
Posted: Thu Mar 25, 2004 11:51 am
by mjseaden
Dear All
Commonly when I am POST-ing information from one page to another, when I press back I (seemingly randomly) get the typical 'Web Page Has Expired' message, and the request to refresh.
Is there any way I can get it to refresh automatically (on all platforms) without the need to hit the refresh button, and therefore get rid of these unprofessional-looking messages?
Many thanks
Mark
Posted: Thu Mar 25, 2004 1:48 pm
by pickle
No there isn't. This is built into the browser. The reason it says the page has expired is of course because the POST variables are part of the page, and after the form has been submitted, the page no longer exists (kind of). The only pseuod-way to get around this is to put a "back" link in your page somewhere.
Posted: Thu Mar 25, 2004 1:50 pm
by magicrobotmonkey
Yea, thats what I do, only get the post variables for the form when leaving the page, not when entering the next page. Some people still insist on that back button, though! How does this site do it?
Re: Can you resubmit automatically without need for refresh?
Posted: Thu Mar 25, 2004 2:09 pm
by aleigh
mjseaden wrote:Dear All
Commonly when I am POST-ing information from one page to another, when I press back I (seemingly randomly) get the typical 'Web Page Has Expired' message, and the request to refresh.
Is there any way I can get it to refresh automatically (on all platforms) without the need to hit the refresh button, and therefore get rid of these unprofessional-looking messages?
Many thanks
Mark
The problem that you are describing is that the browser has returned to an URL that required POST data. Browsers handle this differently but basically the browser is giving you the dialog because it is concerned that by re-posting the form variables it will cause a side-effect operation like buying you an extra digital camera on amazon.
I have not found any really swell answers to this problem, but I will share one idea; when you 302 the incident page that generated the 302 is stripped from the browsers page. For example
A -> B(302) -> C
When you hit back on C you will go to A, not B. Therefore if you store the result data in the session and 302 them once you receive the post data they will arrive at a page that they will GET rather than POST therefore avoiding the error should they hit back.
I almost feel embarassed suggesting this, so take that for whatever it might be worth.
I generally just live with the problem and try to provide them sufficient in-page navigation that they do not use the back button, but it's a hard habit to break for sure.
Posted: Thu Mar 25, 2004 4:34 pm
by hedge
I have completely gotten rid of that message. After my script processes the post request I do a location header at the bottom (usually back to the same page)... this breaks the request/response cycle.