Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Back button flashing previous page  RSS feed

 
Aditya Mukundan
Greenhorn
Posts: 17
Eclipse IDE Linux Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet in that after including these code:

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

and this:

<script language="JavaScript" type="text/javascript">
window.history.forward(1);
</script>

but after going to page and loging out when back button is pressed still the previous page flashes.
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you trying to disable browser's back button?
If yes, then this flashing is not due to your servlet but due to the Javascript code you have used.
 
Aditya Mukundan
Greenhorn
Posts: 17
Eclipse IDE Linux Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any other way to it?
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aditya Mukundan wrote:is there any other way to it?

No. The correct answer is don't do it. There is no reason or justification for you to be trying to alter the browsers expected behavior. Explain to us exactly what problem you are trying to solve and we'll tell you the correct way to do it.

In addition, the code you posted is not servlet code, it's scriptlet code (Java embedded in a JSP). That's a huge Nope. Do not put code in a jsp.
 
Aditya Mukundan
Greenhorn
Posts: 17
Eclipse IDE Linux Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i did not instead destroyed the session...however that's just for login page ....now i need to find something if url is entered so the page won't go and come back to login page itslef
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!