• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Get rid of Web Page Expired error page when clicking browser's back button.  RSS feed

 
Shiny Suresh
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am getting Web Page Expired error while clicking the back button of the browser, after submitting a form. The form method is POST. ( I have to keep it that way). I tried this code

<%session.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");
%>

in my jsp. Still it is not working. I also tried
<script language="JavaScript" type="text/javascript">
window.history.forward(1);
</script>

If any one could help me resolve this issue, I would appreciate your help.

Thanks,
Shiny.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this article and pay particular attention to the PRG (Post-Redirect-Get) pattern.

The problem is that, without using this pattern, a refresh or back will try to replay the Post, and that's not what you want to happen.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!