2012-06-16 112 views
1

我有一个页面与iframe中的另一个html页面。在这个iframe中,我把这个标题标签防止谷歌浏览器缓存html页面

<META http-equiv="Pragma" content="no-cache"> 
<META HTTP-EQUIV="Expires" CONTENT="-1"> 
<meta http-equiv="cache-control" content="no-cache" /> 

但是Chrome仍然会对其进行缓存,当iframe中的内容发生变化,按F5键,但仍铬加载缓存版本,而不是新的版本。

请告诉我如何让谷歌浏览器缓存此iframe。

+0

看到这个:http://stackoverflow.com/questions/2798272/google-chrome-does-not-honor-cache-policy-in-page-header-if-the-page-is-displaye –

回答

3

在来自服务器的HTTP响应中设置正确的expiry headers。它们覆盖你在meta标签中放置的任何东西。

+0

我很喜欢服务器管理。我把这个.htaccess文件:< “\(HTML | HTM | JS | CSS)$” filesMatch> FileETag无 头未设置ETag的 头设置缓存控制“MAX-年龄= 0,无缓存,无店铺,必重新验证” 头设置附注‘无缓存’ 头集过期‘星期三,1984年1月11日05:00:00 GMT’ 是好的? – Tran

+0

@Tran工作吗?您可能需要清除浏览器缓存。 – robertc

+0

它的工作,谢谢。 – Tran

2

此作品在Chrome中:

<meta http-equiv="cache-control" content="max-age=0" /> 
 
<meta http-equiv="cache-control" content="no-store" /> 
 
<meta http-equiv="expires" content="-1" /> 
 
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> 
 
<meta http-equiv="pragma" content="no-cache" />

我发现这在铬错误。 https://bugs.chromium.org/p/chromium/issues/detail?id=28035