1

Possible Duplicate:
Disable browser's back button

i have one button on page on that button click event page will redirect on the next page now i click on the browser back button but i want to restrict browser back button for some security purpose

does any one know how to block browser back button so that page can not redirect to previous page?

Community
  • 1
  • 1
AB Vyas
  • 2,349
  • 6
  • 26
  • 43
  • If it's for some security purpose, keep in mind that the user can make the client do whatever he wants, and blocking the back button will only inconvenience the people who want to use it and do nothing to prevent experienced users from backing. – Peter Olson Jun 02 '11 at 06:29
  • http://stackoverflow.com/questions/961188/disable-browsers-back-button – Amit Jun 02 '11 at 06:30
  • 1
    Why is your app so amazingly important that it should change the expected behaviour of a browser? In short: ***do not do this***. Write your app correctly, instead. – Marc Gravell Jun 02 '11 at 06:34

2 Answers2

1

Do not disable expected browser behaviour and you can handle the possiblity at your end, but if you really want to do so, there is one work around here...

Just put this javascript on the html section of aspx page above head section.

This causes every back to return with a forward.

<script type = "text/javascript" >
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>
Muhammad Akhtar
  • 51,913
  • 37
  • 138
  • 191
0

Open the webpage in a popup window rather than normal window. So, that you can restrict the popup window from displaying buttons, menus, status and other features.

Srinivasan MK
  • 801
  • 2
  • 10
  • 20