javascript - 应用程序缓存 list 未在 Firefox 中加载,在 Chrome 和 Safari 中正常

标签 javascript firefox html5-appcache

我有以下 list

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

和下面的 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>

还有我的 .htaccess 条目(设置内容类型)

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

我已验证服务器正在设置内容类型。

在 Safari 中,这会输出两条控制台消息

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

在 Chrome 中,这会输出

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

在 Firefox 中我得到

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

在 IE11 中我得到

(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

应用程序 URL 是“http://{host}/~adf/RMC2/release/beta/app.html” app.manifest 和 app.html 在同一个文件夹中。

没有指示可能是什么错误。我可以直接加载 IE 提示的 URL(它与用于加载应用程序的 URL 相同)。

about:cache 在 firefox 中甚至没有列出这个应用程序。

CACHE MANIFEST
app.html

即使使用上面的简单 list ,IE11 和 Firefox 也会报错,IE 在控制台中报 Manifest parse failure 错误。

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

我做错了什么?

更新:

如果我在 ~adf/RMC2/...浏览器。

这是为什么?

最佳答案

在 Firefox 内置的应用缓存验证工具的帮助下,我最终解决了这个问题。

Shift+F2
appcache validate

这表明服务器正在为资源发送 no-store header ,这与它们在应用程序缓存中存在冲突。

从服务器上的 .htaccess 中删除了违规条目,缓存开始工作。

关于javascript - 应用程序缓存 list 未在 Firefox 中加载,在 Chrome 和 Safari 中正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27320038/

相关文章:

java - Selenium 网络驱动程序 : Suppressing untrusted connection message in firefox

javascript - ChromeWorker 设置指向内存的指针或发送大数据。如何?

css - Firefox 中的随机空间问题

html - 应用程序缓存 list

html - 在 Chrome 和 Safari 中禁用应用程序缓存

javascript - 如何在同一索引处输出不同的数组javascript

javascript - jQuery 显示函数短暂闪烁

javascript - CasperJS 奇怪的评估行为

html - 尽管 Chrome 正确缓存 Assets ,但应用缓存无法正常工作

javascript - 从 DOM 中删除一个类也会将其从变量中的项目中删除