htmlgoogle-chromecachingcache-manifest

Chrome aggressively caching HTML with .manifest file


I'm using a .manifest file to tell browsers what resources to cache. Basically contains the following:

CACHE MANIFEST
# This manifest was generated by grunt-manifest HTML5 Cache Manifest Generator
# Time: Fri Jul 24 2015 09:57:13 GMT+0100 (BST)

CACHE:
app.min.js
app.min.css
js/libs/require-min.js
img/leaf.png

NETWORK:
*

This file is linked in the HTML as follows:

<!DOCTYPE html>
<html manifest="/app.manifest">
    <head>
        <style type="text/css" media="all">
    ....

Following reports from Safari users that their UI wasn't respecting the cache file, I changed the filename from manifest.appcache to app.manifest after reading that Safari requires manifest files to have the .manifest extension.

I'm now seeing (in Chrome especially) that the browser hasn't re-fetched the HTML source, so isn't seeing that the manifest file has changed, so isn't loading the new app.manifest file, and is failing to download any of the source. The cache headers (Expires, ETag and Last-Modified) for the /index HTML file have all changed, as has the content of the file, yet Chrome refuses to re-fetch the HTML unless the cache is disabled via devtools.

Does anyone know why Chrome is being so aggressive in holding onto this cached HTML? Any ideas as to how I can get it to re-fetch?


Solution

  • Make sure that /manifest.appcache returns a 404, that's what makes browsers understand that it's obsolete now, they will remove all local cache and reload the page next time, so they'll get it at the new location.