Click here to Skip to main content
15,915,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi....
I have two page "Landing page" and "Home page"..
I declare session on landing page... and pop up one light box on landing page load..in that light box accept button is created..when i click on accept button it redirect to "home page"..after come on home page if i click on Back button of browser , i want that it should not redirect to "landing page"..how i can do this...
please reply
thanks....
Posted

You can use the below code in the home page to disable the back button.

XML
<script type = "text/javascript" >
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>
 
Share this answer
 
Look at this tip/trick
Browser back button issue[^]
 
Share this answer
 
Everyone who told you this can be done, is an idiot. You can write code that seems to work, but if someone wants to break it, it's trivial to do so. You cannot stop the back button from working. Instead, you need to fix your code so that the pages do what you want, for example, having the source code redirect if the person goes back, and turning off caching so that the browser does not cache the page.
 
Share this answer
 

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