即使使用HTTP无缓存头,Chrome也会缓存 [英] Chrome is caching even with HTTP no-cache headers
问题描述
我尝试使用配置了HTTP Headers的PHP文件输出来提供服务,因此内容将不会从Chrome中的缓存中提供。
如果我使用开发工具在Chrome中),并标记禁用缓存选项,然后运行。
但我不想依赖于此,我希望我可以设置HTTP标头在某种程度上,我可以强制Chrome每次都重新加载页面。
以下是我当前尝试的屏幕截图,请注意红色标记。
你可以提供一个好的文档或者我必须申明的标题吗?
预先感谢。
编辑
所以我发现了其他的回复: Chrome缓存就像一个疯狂的浏览器,但因为我记得被告知Chrome需要 Cache-Control
的特殊头文件,我会请保留此问题。
Web浏览器可以使用相同的请求参数来缓存AJAX请求。为了解决此问题,请使用更改的查询字符串。一个例子是使用秒数作为查询参数。
I am trying to serve a PHP file output with HTTP Headers configured so the content will NOT be served from cache in Chrome.
If I go to Dev tools (in Chrome), and mark the "Disable cache" option, then it works.
But I don't want to depend on that, I hope I can setup HTTP headers in a way I can force Chrome to reload the page everytime.
Here's a screenshot of my current attempt, please note the red marks.
Could you please provide good documentation or which headers I must declare for this ?
Thanks in advance.
Edit
So I found this other reply too: Chrome caching like a mad browser, but since I recall being told that Chrome needs special headers for Cache-Control
, I will keep this question.
Web browsers can cache AJAX requests with the same request parameters. In order to work around this problem, use a query string that changes. One example would be to use the date in seconds as a query parameter.
这篇关于即使使用HTTP无缓存头,Chrome也会缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!