简体   繁体   English

历史背力刷新

[英]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. 我有一个应用程序,当用户登录仪表板时(存在cookie),他可以注销。 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? 如果还有其他任何方式,那么javascript cookie检查(在注销后已被删除,并且当cookie不存在时将强制执行document.location ='/')强制重新加载此页面,以便它将自动被选中通过我的服务器端验证检查?

Cheers, 干杯,

Mattijs 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的真实状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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