Howdy. I was wondering how to stop the browsers back button from working after a user has logged out. I tried the windows.history.forward(1); function but it either is not working for me, or I am not putting it int the right place.
The logout button is on the menu.php page. The button calls the logout.php file which redirects the user to the index.php page after logout.
Any hints or a good tutorial would be great, thank you.
Disable browser back button after logout
Page 1 of 13 Replies - 2389 Views - Last Post: 15 June 2011 - 06:30 AM
Replies To: Disable browser back button after logout
#2
Re: Disable browser back button after logout
Posted 14 June 2011 - 06:40 PM
You could try sending to them to the login page if they try to access a page that requires them to be logged in?
#3
Re: Disable browser back button after logout
Posted 14 June 2011 - 10:34 PM
I wouldn’t bother with that, if the user is logged out, every access to one of the restricted pages should redirect him to the login page.
#4
Re: Disable browser back button after logout
Posted 15 June 2011 - 06:30 AM
You can't disable the back button. I guess you can't either mess up the browser history (window.history).
I tried:
On FF 3, a.html doesn't show up in the history, guess they prevent the user from being trapped. On IE 8, the user have to manually allow the execution of this, then a.html redirects to b.html and the a.html is the first page on the back button. Terrible solution, the user is just trapped (back button keep redirecting to b.html).
The real problem is caching. You can add the meta tag:
But you can prevent cache better at server-side.
I tried:
<!-- a.html --> <script>window.location.href = './b.html';</script>
On FF 3, a.html doesn't show up in the history, guess they prevent the user from being trapped. On IE 8, the user have to manually allow the execution of this, then a.html redirects to b.html and the a.html is the first page on the back button. Terrible solution, the user is just trapped (back button keep redirecting to b.html).
The real problem is caching. You can add the meta tag:
<meta http-equiv="Pragma" content="no-cache" />
But you can prevent cache better at server-side.
This post has been edited by anonymouscodder: 15 June 2011 - 06:31 AM
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote





|