如何关闭chrome中的网站缓存?

时间:2015-11-16 14:53:43

标签: html google-chrome caching

我试图阻止在浏览器上缓存机密文件(chrome),因此每次发出请求时,都要从服务器获取文件,而不是从缓存中查看。我添加了以下html元标记,以指示chrome浏览器不缓存,但没有运气。

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

在检查网络流量时,根据请求将缓存控制设置为max-age = 0。和私人的回应。

我有这个在IE上工作。

1 个答案:

答案 0 :(得分:0)

通常你宁愿在.htacces文件中根据文件类型(或任何其他模式)执行此操作,例如:

<IfModule mod_headers.c>
 <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=604800, public"
 </FilesMatch>

 <FilesMatch "\.(js|css)$">
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
 </FilesMatch>
</IfModule>

用您选择的模式替换我的简单示例。此处的参考资料还有关于此主题的更多详细信息:http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html

相关问题