简体   繁体   中英

history back force refresh

I have an application and when user is logged in (a cookie is present) in the dashboard, he can log out. When he does so, he can hit history button on browser which takes him back to dashboard from cache.

If there any other way then a javascript cookie check (which has been removed after logout, and will force a document.location = '/' when cookie is not present) to force a reload of this page so it will automatically will be picked up by my serverside authentication check?

Cheers,

Mattijs

This is what my company uses to expire the page cache:

<cfheader name="Expires" value="#GetHttpTimeString(Now())#">
<cfheader name="Pragma" value="no-cache">
<cfheader name="cache-control" value="no-cache, no-store, must-revalidate ">

Set headers to expire the page cache? These two headers should do the trick.

Cache-Control: no-cache, must-revalidate

Expires: Thu, 29 Jul 2000 05:00:00 GMT // Any date in the past would do

也许这不是您期望的答案,但您可以设置无限循环(例如,间隔10秒),您可以在其中向您的服务器发送AJAX请求,该服务器知道cookie的真实状态。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM