我了解到,当您无法访问 Web 服务器的 header 时,您可以使用以下方法关闭缓存:
<meta http-equiv="Cache-Control" content="no-store" />
但我也读到这在某些版本的 IE 中不起作用。是否有任何一组 <meta> 标签可以关闭所有浏览器中的缓存?
最佳答案
适用于现代网络浏览器(IE9 之后)
有关正确信息,请参阅页面顶部列出的副本!
在此处查看答案:How to control web page caching, across all browsers?
适用于 IE9 及之前
不要盲目复制粘贴!
The list is just examples of different techniques, it's not for direct insertion. If copied, the second would overwrite the first and the fourth would overwrite the third because of the http-equiv declarations AND fail with the W3C validator. At most, one could have one of each http-equiv declarations; pragma, cache-control and expires. These are completely outdated when using modern up to date browsers. After IE9 anyway. Chrome and Firefox specifically does not work with these as you would expect, if at all.
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
其实根本不用这些!
Caching headers are unreliable in meta elements; for one, any web proxies between the site and the user will completely ignore them. You should always use a real HTTP header for headers such as Cache-Control and Pragma.
关于html - 是否有一个 <meta> 标签来关闭所有浏览器中的缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1341089/