Opera 和 Safari 上的 CodeIgniter 会话问题
我正在使用 codeigniter 1.7.2。
在我的网络应用程序中注销后,单击浏览器的后退按钮,页面将重新加载到登录页面中。
此问题仅发生在 Opera 和 Safari 上。 我已经使用元禁用了缓存,但这没有帮助。 :(
<meta http-equiv="PRAGMA" content="NO-STORE" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="CACHE-CONTROL" content="NO-STORE" />
请帮忙..
I am using codeigniter 1.7.2.
In my web app after logging out, on clicking the back button of the browser the page is reloaded in the logged in page.
This issue is occuring on Opera and Safari only.
I have disabled cache using meta, but that doesn't help. :(
<meta http-equiv="PRAGMA" content="NO-STORE" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="CACHE-CONTROL" content="NO-STORE" />
Please help..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能展示如何使用元禁用缓存吗?
浏览器使用单独的缓存机制来存储浏览器历史记录。即使您禁用了缓存,浏览器仍可能存储浏览器历史记录的页面。
Cache-Control: no-store
标头应该完全阻止存储页面。发送此标头的最佳方法是使用 PHP 而不是依赖元元素:另请参阅:什么是可缓存的,了解
Cache-Control: no-cache
和Cache-Control: no-store
更新:这在 Opera 中不起作用,至少在 Firefox 和 Chrome 中起作用。
Can you show how you disabled cache using meta?
Browsers use a separate caching-mechanism for browser history. Even if you disabled the cache a browser may still store a page for the browser history. The
Cache-Control: no-store
header should prevent storing pages at all. The best way to send this header is using PHP instead of relying on meta-elements:Also see: What is Cacheable for the difference between
Cache-Control: no-cache
andCache-Control: no-store
Update: This doesn't work in Opera, it works at least in Firefox and Chrome.
简短回答:防止 Opera 在历史导航(后退/前进按钮)上使用缓存的唯一方法是使用 Cache-control: Must-revalidate 来通过 https 提供页面标头。
Short answer: the only way to prevent Opera from using cache on history navigation (back/forward button) is to serve the page over https with Cache-control: must-revalidate header.