When the user clicks the back button, the browser displays a cached version of the page, which is exactly what the user saw when he first loaded this page. However, there is no contact with the server at all to show this cached version of the page. The cached version of the page will look exactly the same as when loading it, so you can see the user who was registered when the page was loaded. However, this does not mean that the user is still registered.
If you want the user not to return to the previous cached pages, the easiest way is to delete the browser history when the user logs out. You cannot do this directly, but there is a workaround that gives the same result. Run this javascript:
var Backlen=history.length; history.go(-Backlen); window.location.href='new page url';
So, you need to return the page with this JavaScript, and where you read the 'new page url' , you need to insert the page into which you want to redirect the user when he logs out.
Of course, avoiding caching, as in Ravinder Singh's answer, is an option, but it is not recommended to avoid caching all pages by the browser.
JotaBe Jan 02 '15 at 9:40 2015-01-02 09:40
source share