2

I have Logout Link in the home page and on clicking that link I am redirecting user to the login page.

When user click on back in browser it redirecting to home page after loutout.

How to stop this.

I have tried using javascript code at the header of login page.

<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>

Help me out here.

Venkat Maridu
  • 892
  • 3
  • 22
  • 45
  • the best is to use location.replace(url) when navigating and having your application handle revisiting on the server. – mplungjan Feb 22 '13 at 07:42
  • possible duplicate of [easiest way to prevent the back button of your browser from showing secure data after a user logs out?](http://stackoverflow.com/questions/211001/easiest-way-to-prevent-the-back-button-of-your-browser-from-showing-secure-data) – JJJ Feb 22 '13 at 07:46
  • You ll find answer [here](http://stackoverflow.com/questions/3642919/javax-faces-application-viewexpiredexception-view-could-not-be-restored/3642969#3642969) – Vikas V Feb 22 '13 at 08:31
  • possible duplicate of [Avoid back button on JSF+Primefaces application](http://stackoverflow.com/questions/10305718/avoid-back-button-on-jsfprimefaces-application) – BalusC Feb 22 '13 at 11:15
  • 3
    Do not use JavaScript. That's plain stupid. See also http://stackoverflow.com/questions/4194207/prevent-user-from-going-back-to-the-previous-secured-page-after-logout/4194251#4194251 – BalusC Feb 22 '13 at 11:16

0 Answers0