2012-06-16 108 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