4

I want to use HTML5 app cache in my MEAN app but I can't make it work in Firefox 36. It works in Chromium as expected. This is my file structure:

client
    app.js
    manifest.appcache
    views/
        index.html
        about.html
server.js

index.html:

<!DOCTYPE html>
<html manifest="/manifest.appcache">
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <a href="views/about.html">About</a>
  </body>
</html>

manifest.appcache:

CACHE MANIFEST
#0
CACHE:
views/about.html
app.js

server.js:

var http = require("http");
var express = require("express");
var app = express();

app.get("/manifest.appcache", function (req, res) {
    res.set("Content-Type", "text/cache-manifest");
    res.set("Cache-Control", "no-store, no-cache");
    res.set("Expires", "-1");
    res.sendFile("/client/manifest.appcache", {root: __dirname});
});
app.get('/', function (req, res) {
    res.sendFile('/client/views/index.html', {root: __dirname});
});
app.use(express.static(__dirname + '/client', { maxAge: 31557600000 }));
app.listen(8080);

When I go to localhost:8080, Firefox successfully fetches the manifest (which is not visible in the network tab of dev tools) but it does not store the files in the app cache (Preferences - Advanced - Network shows 0 bytes). It loads them from the standard system cache (I get 304).

I suspect that my routing somehow breaks the links in manifest.appcache but I had to prevent the manifest to be cached itself. I'm not an expert on Node.js and I'm confused by the fact that Chromium and Firefox behave differently. Any help will be appreciated.

0 Answers0