Aus*_*nce 2 javascript firefox html5-appcache
我有以下表现
CACHE MANIFEST
# cache-revision-29541
# cache-creation-date: Fri Dec 5 11:33:29 GMT 2014
CACHE:
app.html
NETWORK:
*
Run Code Online (Sandbox Code Playgroud)
以及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>
Run Code Online (Sandbox Code Playgroud)
和我的.htaccess条目(设置内容类型)
AddType text/cache-manifest .manifest
ExpiresByType text/cache-manifest "access plus 0 seconds"
Run Code Online (Sandbox Code Playgroud)
我已经验证服务器正在设置内容类型.
在Safari中,这会输出两个控制台消息
Cache Event checking Status: 2
Cache Event noupdate Status: 1
Run Code Online (Sandbox Code Playgroud)
在Chrome中,此输出
Cache Event checking Status: 2
Cache Event noupdate Status: 1
Run Code Online (Sandbox Code Playgroud)
在Firefox中,我得到了
Cache Event checking Status: 0
Cache Event error Status: 0
Run Code Online (Sandbox Code Playgroud)
在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
Run Code Online (Sandbox Code Playgroud)
应用网址为"http:// {host} /〜adf/RMC2/release /beta/app.html"app.manifest和app.html位于同一文件夹中.
没有迹象表明错误可能是什么.我可以直接加载IE抱怨的URL(它与用于加载应用程序的URL相同).
about:firefox中的缓存甚至没有列出这个应用程序.
CACHE MANIFEST
app.html
Run Code Online (Sandbox Code Playgroud)
即使有上述简单的清单,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
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
更新:
如果我在~adf/RMC2 /中安装app.manifest和app.html ...它适用于所有浏览器,当它安装在子文件夹版本/ beta中时,它在firefox和IE中不起作用.
这是为什么?
我最终借助Firefox内置的appcache验证工具来解决这个问题.
Shift+F2
appcache validate
Run Code Online (Sandbox Code Playgroud)
这表明服务器正在为资源发送no-store标头,这与它们在应用程序缓存中是冲突的.
从服务器上的.htaccess中删除了有问题的条目,缓存开始工作.
| 归档时间: |
|
| 查看次数: |
2033 次 |
| 最近记录: |