如何停止缓存HTML,但继续缓存其他资源



我希望浏览器只缓存图像,而不是html文档,因为当我修改.html时,浏览器显示缓存的旧版本。这是<中指定的manifest.appcache;html>:

缓存清单

设置:喜欢在线

网络:

*

回退:

缓存:

/img/cap.gif

/img/descarga (53) gif

/img/descarga (3) gif

/img/descarga (7) gif

我已经尝试指定HTTP报头

Cache-Control:no-cache, max-age=0

Expires:到一个等于日期头的日期,未来1分钟和过去1年的日期

Pragma:no-cache

,正如我在另一个问题中看到的,我在HTML头部设置了标签:

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"

但是没有这个工作,浏览器缓存图像和html,有另一个解决方案吗?,谢谢。

把这个放在。htaccess中,这个停止了特定文件类型的缓存

<filesMatch ".(jpeg,png)$">
FileETag None
<ifModule mod_headers.c>
 Header unset ETag
 Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
 Header set Pragma "no-cache"
 </ifModule>
</filesMatch>

最新更新