Application cache manifest not loading in Firefox,

2019-07-19 17:12发布

问题:

I have the following manifest

CACHE MANIFEST
# cache-revision-29541
# cache-creation-date: Fri Dec  5 11:33:29 GMT 2014
CACHE:
app.html
NETWORK:
*

And the following app.html

<!DOCTYPE html>
<html manifest="app.manifest">
<head>
    <title>cache test</title>
    <script>
    function checkCache() {
        var appCache = window.applicationCache;
        var logACEvent = function(e) {
            console.log("Cache Event " + e.type + " Status: " + appCache.status);
        }
        appCache.addEventListener('error', logACEvent, false);
        appCache.addEventListener('checking', logACEvent, false);
        appCache.addEventListener('noupdate', logACEvent, false);
        appCache.addEventListener('downloading', logACEvent, false);
        appCache.addEventListener('progress', logACEvent, false);
        appCache.addEventListener('updateready', logACEvent, false);
        appCache.addEventListener('cached', logACEvent, false);
    }
    checkCache();
    </script>
</head>
<body>
</body>
</html>

And my .htaccess entries (to set content type)

AddType text/cache-manifest .manifest
ExpiresByType text/cache-manifest "access plus 0 seconds"

I have verified the server is setting the content type.

In Safari, this outputs two console messages

Cache Event checking Status: 2
Cache Event noupdate Status: 1

In Chrome, this outputs

Cache Event checking Status: 2
Cache Event noupdate Status: 1

In Firefox I get

Cache Event checking Status: 0
Cache Event error Status: 0

In IE11 I get

(i) Resource doesn’t exist on the server: 'http://10.119.103.2/~adf/RMC2/release/beta/app.html'.
(i) AppCache Fatal Error
Cache Event error Status: 0

The app URL is 'http://{host}/~adf/RMC2/release/beta/app.html' app.manifest and app.html are in the same folder.

No indication of what the error might be. I can load the URL that IE complains about directly (its the same URL used to load the app).

about:cache in firefox does not even list this application.

CACHE MANIFEST
app.html

Even with the above simple manifest, IE11 and Firefox are reporting an error, with IE reporting a Manifest parse failure error in the console.

HTML1300: Navigation occurred.
File: app.html
Creating AppCache with manifest: 'http://10.119.103.2/~adf/RMC2/release/beta/app.manifest'.
Cache Event checking Status: 0
Manifest parsing failure: 'http://10.119.103.2/~adf/RMC2/release/beta/app.manifest'.
AppCache Fatal Error
Cache Event error Status: 0

What am I doing wrong?

Update:

If I install app.manifest and app.html in ~adf/RMC2/... it works in all browsers, its when it is installed in the sub-folders release/beta that it doesn't work in firefox and IE.

Why is that?

回答1:

I figured this out eventually with the help Firefox's built in appcache validate tool.

Shift+F2
appcache validate

This indicated that the server was sending no-store headers for the resources, which is in conflict with them being in the application cache.

Removed the offending entries from .htaccess on the server and the cache started working.