0

I have a vb .net application in which i'm using a user control for the user registration. This user control has 3 buttons and three asp panels. In each button click corresponding panel will be shown. I need to hide the browser back button functionality only in the 3rd button click. How can i do it? Anyone please help me.

I have tried by putting this line of script in the aspx page which contains the user control.

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

But it didnt work for me.

Sudha
  • 2,078
  • 6
  • 28
  • 53
  • 2
    Disabling browser functionality is usually a bad idea, and aggravates users to no end. What's wrong with using the back button? If the user requests a previous step in this process, can't you just direct them back to the current step from server-side code? Ideally it would be an even better user experience to have the entire registration process take place in a single page by showing/hiding elements dynamically, which would remove the back button from the picture entirely. – David Jul 24 '13 at 13:41
  • I agree, a web application should be able to handle the back button. – Alexander Jul 24 '13 at 13:50
  • possible duplicate of [Disable browser's back button](http://stackoverflow.com/questions/961188/disable-browsers-back-button) – Praveen Jul 24 '13 at 13:54

1 Answers1

0

Try this

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

    function noBack() {
        window.history.forward();
    }
</script>

<BODY onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">

check the DEMO here.

On searching, many geek suggest that this kind of behavior is not good for browser.

Praveen
  • 55,303
  • 33
  • 133
  • 164