2

I have a page with another html page in iframe. In this iframe, i put this header tag

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

But chrome still cache it, when iframe content changed, hit f5 button but chrome still load cached version, not new version.

Please tell me how to pevent google chrome cache this iframe.

Rakhat
  • 4,783
  • 4
  • 40
  • 50
Tran
  • 185
  • 2
  • 4
  • 15
  • See this: http://stackoverflow.com/questions/2798272/google-chrome-does-not-honor-cache-policy-in-page-header-if-the-page-is-displaye – Marcel N. Jun 16 '12 at 19:27

4 Answers4

5

Set the correct expiry headers in the HTTP response from your server. They override anything you've put in meta tags.

robertc
  • 74,533
  • 18
  • 193
  • 177
  • I'm noob at server managerment. I put this on .htaccess file : FileETag None 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" Is good ? – Tran Jun 16 '12 at 19:57
  • @Tran Is it working? You'll probably need to clear you browser cache. – robertc Jun 16 '12 at 20:14
1

This works in 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" />

I found this in a Chromium bug. https://bugs.chromium.org/p/chromium/issues/detail?id=28035

jelwell
  • 29
  • 1
0

Meta tags can be ignored. Instead of them your server should set appropriate HTTP headers for cache control. You should also set the Expired header.

https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Avoiding_caching

datenwolf
  • 159,371
  • 13
  • 185
  • 298
0

I found that Chrome may ignore those meta settings in the file in favor of the cache settings in http response header. I was able to fix this issue in IIS by adding this in my web.config

<system.webServer>
  <staticContent>
    <clientCache cacheControlMode="NoControl" />

Files still get cached but now I can explicitly exclude a file if I need to.

nuander
  • 1,319
  • 1
  • 19
  • 33