• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

disable the back button in webapplication

 
sandy indira
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
disable the back button in webapplication


after logout the user is sent back to the login page and there if he press the back button the request should go to the controller(server) and
check whether is he properly logged in if yes allow him other wise display the login page...


help guys give me some nice code or some good suggestions for this...
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally browsers store pages in their cache and when you press the back button, the browser displays the page from its cache. To make the browser request the page again from the server (so that you can check whether the user is logged in or not), you'll have to put some headers in the pages which you only want to be visible after user is logged in. Read this to know which headers to use...
 
Maneesh Godbole
Saloon Keeper
Posts: 11073
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sandy indiranagar wrote:

Like I had requested you before here you really need to check your private messages and take appropriate action. Please note this is not optional.

It is expected you take the required action, before you post again.
 
sandy indira
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
friend i dont want to disable the back button instead i want to create a check on user..

after logout if he press the back button the request should go to the controller and check is he a valid user if yes
allow him or if not redirect him to the login page...


and i saw the private message there were no new messhages...plss i have seen the naming convention..even if needed i can again change just tell me if needed...
 
Maneesh Godbole
Saloon Keeper
Posts: 11073
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
sandy indira
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
friends i tried all these but it didnt help..

it still caching the data...i.e the name if the user and allowing him to come back to the home page after logout by pressing back button...

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
<meta http-equiv="expires" content=<%= new java.util.Date() %>>
<meta http-equiv="no-cache">
<script type="text/javascript"></script>
</head>
<body>

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



<--body of my page----->

</body>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</html>
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandy please restrict talk about one problem to one thread, don't post the same problem multiple times like here or here...
 
Ronnie Reed
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandy , which framework are you using . Spring implicitly handles this because each request madatorily hits the controller before the JSP is invoked. If you are using Struts you might have to write an Ajax call on the "onPageLoad" of the previous page which the control would go on hitting back and then send the request to a different class where you can perform some logic.

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic