Prevent google chrome cache html page

34,516

Solution 1

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

Solution 2

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

Share:
34,516
Tran
Author by

Tran

Updated on August 30, 2020

Comments

  • Tran
    Tran over 3 years

    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.

  • Tran
    Tran almost 12 years
    I'm noob at server managerment. I put this on .htaccess file : <filesMatch "\.(html|htm|js|css)$"> 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" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" </ifModule> </filesMatch> Is good ?
  • robertc
    robertc almost 12 years
    @Tran Is it working? You'll probably need to clear you browser cache.
  • Evgeny Fedorenko
    Evgeny Fedorenko over 5 years
    this did not work for me, chrome still gets if from cache.
  • Mark G
    Mark G over 4 years
    Just to let you know, this unfortunately does not work. Had these exact settings and a new release caused hell across the country!