Tarun Dudhatra |
Apr 14, 2011 |
While we are developing any web application then some times it's necessary to disable the back button effect from the browser. This is common in banking websites and other sites where security is major concern. User may hit the back button from the browser and forget to log out from the site.
There fore it's required to disable browser's back button.
So here is the code which will prevent user to go back on previous page.
Here I have given 2 pages page 1 and page 2. From page 1 I am going to page 2 using page 2 link. Now if I will click on page 2's browser back button it will go to page 1 but from page 1 it will again forward to page 2 so user can't go to the page 1 using back button.
Note : Above code is tested in IE 9.0 and Firefox 3.6.8