我有以下清单应用缓存清单在Firefox,Chrome浏览器确定和Safari
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:firefox中的缓存甚至不会列出此应用程序。
CACHE MANIFEST
app.html
即使采用上述简单的清单,IE11和Firefox被报告错误,用IE报告在控制台一个Manifest解析失败的错误。
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
我在做什么错?
更新:
如果我安装app.manifest和app.html在〜ADF/RMC2/...它工作在所有的浏览器,它当它被安装在子文件夹释放/测试版,它在Firefox和IE中不起作用。
这是为什么?
谢谢,我有一个类似的问题。使用'appcache validate'你会得到一个有用的信息来回答错误。在我的情况下,我通过FTP上传了我的文件。但是,由于cache.manifest文件在一些缓存文件之前上传,Firefox抱怨说有些缓存文件比cache.manifest文件更新。我的解决方案是上传所有文件,然后等待10秒,然后再上传cache.manifest。你不相信...... – 2016-01-02 11:54:15