javascript "window.history.forward(1);" not working.

Posted by Ray L. on Stack Overflow See other posts from Stack Overflow or by Ray L.
Published on 2010-12-30T19:18:56Z Indexed on 2010/12/30 20:53 UTC
Read the original article Hit count: 143

Hi, I'm trying to prevent the back button from working on one of my asp.net mvc pages. I've read a couple of places that if i put "window.history.forward(1);" in my page it will prevent the back button from working on a given page. This is what I did in my page:

<script type="text/javascript">
        $(document).ready(function () {
            window.history.forward(1);
        });
    </script>

It doesn't seem to be working. Am I using this incorrectly or is this approach wrong? thanks.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about back-button