Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / Javascript

Regarding back button after signout

3.17/5 (6 votes)
20 Nov 2011CPOL 21.8K  
Regarding back button after signout
In your webpage after signout and pressed back button, the previous session will remain the same. So use the below JavaScript. So that previous session will open.

For example: In our CodeProject.com after signout press back button .. your previous session will remain the same.


<script type="text/javascript">
        function noBack()
         {
             window.history.forward()
         }
        noBack();
        window.onload = noBack;
        window.onpageshow = function(evt) { if (evt.persisted) noBack() }
        window.onunload = function() { void (0) }
    </script>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)