0

I have a web site where I added a CACHE MANIFEST file. This was to ensure that full-screen web apps in iOS wouldn't fetch things from cache. (Otherwise, they seem to refresh HTML properly, but not linked JavaScript or CSS.) In my application, off-line access is totally useless, so I created the manifest to not cache anything. Here's what it looks like:

CACHE MANIFEST

# Version 1.0

NETWORK:
*

This fixed my issues in iOS, but it seems to mess up Chrome (40.0.2214.115 m). Chrome insists on always fetching my base html file from cache even with the development tools open and "Disable cache" checked. If I can simply remove/rename the cache manifest file and refresh, that fixes the problem. In addition, my base HTML file has these headers:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>

Is there something I am missing here? Seems odd that Chrome would do more caching when I have a manifest file present that says to do no caching.

Jon
  • 407
  • 1
  • 3
  • 11

2 Answers2

0

If you specify a cache-manifest in a HTML file, it will always be cached to the applicationCache, regardless if it has the headers/meta-tags specified that you posted (see here Cache manifest caches network files).

If you want to avoid caching JS and CSS files, just use a .htaccess file in the root-directory of the web-app. For example with the "ExpireByType" command:

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 0 seconds"
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType text/plain "access plus 0 seconds"
  ExpiresByType text/javascript "access plus 0 seconds"
  ExpiresByType text/css "access plus 0 seconds"
  ExpiresByType image/png "access plus 0 seconds"
  ExpiresByType image/jpg "access plus 0 seconds"
  ExpiresByType image/jpeg "access plus 0 seconds"
</IfModule>

Furthermore, you could add the following lines to disable cache for your web-app completly (see this Disabling Caching with .htaccess):

  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 "Mon, 1 Jan 2010 01:00:00 GMT"
  </ifModule>
0

This behavior has been fixed in Chrome 41.0.2272.76 m. It no longer fetches files from cache for my site with the manifest file.

Jon
  • 407
  • 1
  • 3
  • 11