Prevent back button after logout
down vote Add the below code inside script tag in the login HTML page (or whichever page it redirects to after logout) <script> history . pushState ( null , null , null ); window . addEventListener ( 'popstate' , function () { history . pushState ( null , null , null ); }); </script> It will disable the back button. You will not be able to go back by clicking on the back button. Note: Not tested on Safari. // Note that although users can't change anything after resetting session data and/or cookie, they still may see usual information accessible to a logged in user as they appeared on the last visit. That is caused by browser caching the page. You have to be sure to add the header on every page accessible by a logged in user, telling the browser that the data is sensitive and they should not cache the script result for the back button. It is important to add header ( "Cache-Control: no-cache, must-...