Search This Blog

Monday, July 19, 2010

How to prevent Back button in browser?

Write down below lines in script tag in your page.
        function noback() {
            window.history.forward();
        }
        noback();
        window.onload = noback;     
        window.onunload = function() { void (0); }



For example suppose you have one page "Signout.aspx", your write down this code in this page. This page signs out user from the site then redirects to your home page so from the home page user cannot come again to "Signout.aspx" page.

No comments:

Post a Comment