• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

controlling going back to previous page after logout

 
bhaskar ganapathi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all


after logout from web site , one can go back to the previous pages using browser's back button.

any idea how to controll it.

what i need is after logout if some one clicks the browser's backbutton it should go to login page.

thanks

Bhaskar G
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to HTML/Javascript forum.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are working on Jsp or servlet, just explore Session tracking mechanism ...
 
bhaskar ganapathi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am working on jsp. i tried so many cache control mechanisum

like adding following code on top of each jsp


<%

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

%>

but it did not work. after log out if i click browser back button

it shows pages that is protected by session
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not you check for the session variable like the userId or any thing .. if it's null you can redirect the user to home page.
[ September 23, 2005: Message edited by: Srinivasa Raghavan ]
 
bhaskar ganapathi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i click browser back button it is not at all hitting the server.

it is entirely due to browser cache.
 
Vidya Ramakrishnan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working in javascript on the client side and php on the server side

can anyone please help me with javascript for the above mentioned problem???

Thanks...
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javascript? That's already too late then. The response is already arrived at the client at the moment JS starts to run.

Just set the appropriate response headers using HTML or PHP.

As you're here at a HTML forum, here's the HTML equivalent:

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should add, this does not prevent the user from actually going back to the previous page (which is simply impossible). It just prevents the previous page being viewed from the browser cache, which would make the user think: "Hey, I am already logged out, why do I still see the secured page?!". Adding the response headers prevents the page being cached in the browser, so the browser is forced to actually fire a request to the server, where you can easily check if the user is logged in or not and handle the response accordingly.
 
Vidya Ramakrishnan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the cache-control mechanism doesnt work for me. I tried using session variables in php --session_register and session_destroy;
But still I am not able to go ahead.
Anyone please help me with steps in using session variables.

I am new to php. So it is a bit difficult for me.Please help

Thanks..
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a PHP forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic