Tuesday, July 1, 2014

Avoid user to go back to previous page after Log-out !!!

Hello Friends,
Many time we face this issue that once logout from our site, if we press back button of the browser, we go to the previous page..

This is ambiguity
To avoid this we can follow below things..

observed one thing in our many websites that - When user (Admin or Front end user) log-outs from website, user is redirected to login page. But on Login page when user clicks on back button of browser, he is redirected to previous page (the page which user was accessing just before log-out), which is logically incorrect. If user log-outs from the system, he should not be able to see previous page even if he clicks on back button.

To avoid this page back issue we have to add just a small JavaScript into out AdminMaster and UserMaster page.

Please find the following Javascript:

<script type="text/javascript" language="javascript">
    function disableBackButton()
    {
        window.history.forward();
    }
    setTimeout("disableBackButton()", 0);
</script>

You can use it in your projects to avoid the issue and to improve your project quality more.



No comments:

Post a Comment