Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Browser back button

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I click back button in internet explorer, my application gives me a blank page.I get the following message:

Warning: Page has Expired
The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you

I am using javascript to set the action of form and then submit the form.

I have kept some information in session object also.

I am unable to debug, why this is happening.

Please help..

Thanks,
Neeraj
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because...The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.

More or less because you used javascript to submit the form and now that data is not available when you press the back button.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what can be done to avoid this except avoiding the javascript.

Thanks,
Neeraj.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
at my system..i think this is happening on this site also pls. somebody check and correct me..

Thanks,
Neeraj.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More or less because you used javascript to submit the form and now that data is not available when you press the back button.
This would happen if you had no JavaScript in the page... happens to me all the time when I press back!

By pressing back, you are asking the POST request from your form to be re-submitted to the server. As the original message says, IE warns against this for POST methods only (since POST is non-idempotent) to prevent accidental submission of the data twice. If you really want to submit the data again, you can refresh while on the warning page.

Several patterns have been developed to ensure you don't see this, the most common being the Post/Redirect/Get... in essence it uses a GET redirect so the POST request is 'lost' from the browser's history, thus preventing re-submission of the form. For example, see:

http://www.theserverside.com/patterns/thread.tss?thread_id=20936
http://www.theserverside.com/news/thread.tss?thread_id=29758

I think Bear also wrote an article on this pattern a while ago as well, but I can't find a link to it right now...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65224
95
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic