• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

controlling going back to previous page after logout

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to HTML/Javascript forum.
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This isn't a PHP forum.
 
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic