Is there a way to update the login status on callback in the application

I am currently logged into an account. After you have visited some of my pages, I log out of my account. Now if I return to the page using the back button in the browser, I still enter the login state. Is there a way to set this status as logout?

+3


source to share


3 answers


The problem with browsers is that using the back button does not refresh the page to any form of data on the server, or force the browser to run any JavaScript load functions.

What you can do is set the JavaScript function to timeout to check if they register every 10 seconds using AJAX.



I wouldn't bother as you are adding additional server load with no real benefit, as when the user refreshes the page or clicks on a link, they will still be logged out and unable to perform any action records.

+5


source


Most likely, the pages will be cached in the browser.

Install the app on server-side pages, disabling their caching - this way returning them will reload them from the server and display the logged out state, rather than pulling them out of the browser cache.



How to do this is outside the scope of the question. Google for "no-cache" and "Expires" headers.

0


source


Add nocache tags to <head>...</head>

your secret pages.

<META http-equiv="Pragma" content="no-cache">

      

This is because when you visit a page on your site, the page is automatically cached in the browser. And when you come back after logging out, these pages are served directly from the browser cache. You need to disable the cache so that when you return after logging out, these pages are called from the server again.

0


source







All Articles