Click here to Skip to main content
15,894,539 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web application, and I want to disable back button on web browser using ASP.NEt and Vb.NET.

My application has Home/About us/Claims as menu items Three pages and a master page.

Now I click on About us/Home page backbutton is enabled. That's also good. When I click on Claims it is enabled. Here is my problem. I want to disable backbutton on Claims always. Hope I made it clear


Can anyone in here help me out on this?
Posted
Updated 9-Jan-15 7:23am
v2
Comments
ZurdoDev 9-Jan-15 12:13pm    
That's a bad idea. Why do you want to do it?
sudevsu 9-Jan-15 12:18pm    
Because, I have a Claim Form that must not be going back before submitting it after filling. If user enters the form and clicks on back button in between something that is going to be refreshed. I just want to disable back button until user fills and submits the form.
ZurdoDev 9-Jan-15 12:21pm    
Because it's part of the browser I'm not sure there's a good way of doing it. If you google it, you'll certainly find some answers.
sudevsu 9-Jan-15 12:29pm    
I tried this way but it works only once.
window.history.forward(); Adding this line to your javascript make it work. But it works only once.
I always ask Experts in here only after searching in google.
ZurdoDev 9-Jan-15 12:34pm    
I googled "how to disable browser back button" and there's lots of results.

1 solution

So Here is what I have done to make it work the way I wanted to an extent.
Add the below JavaScript in Home/ About Us page. Nothing in Claims.

XML
<script language="javascript" type="text/javascript">
     window.history.forward(-1);
     </script>


This made my back button disable when I log in and When I click on menu items to change it is enabled. But If I come back to Claims I still see it as enabled but when you click on back button it remains in same page (Claims). That is what it should work like in my application.
 
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