Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have a login form when user logged in it should redirect to next page. If i close the browser or select log off or browser's back button is clicked the user must be logged off and again login page should be shown. This works fine. But if i click the browser's forward button without giving any user name password the browser goes to next page. This should not happen. How to solve this. Pls help me.
Posted

Try this on your logged in Home page
JavaScript
<script type="text/javascript">
if (window.history.forward(1) != null)
      window.history.forward(1);

if (window.history.backward(1) != null)
      window.history.backward(1);
</script>
 
Share this answer
 
v2
Comments
Christian Graus 13-Dec-12 2:53am    
This is pure idiocy. It only works for people who don't want to stop it from working. It is no solution for knowing how to write web pages
Killzone DeathMan 13-Dec-12 5:09am    
Agree :P
You need to fix your code, so that it knows your logged in pages are not cached. You can't stop the back and forward buttons from working, you just need to write code that works.
 
Share this answer
 
Comments
Member 9650694 13-Dec-12 2:45am    
How to do that in php?
Christian Graus 13-Dec-12 2:53am    
http://www.i18nguy.com/markup/metatags.html - PHP has nothing to do with it. Your HTML tells the browser not to cache the page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900