我有以下清單應用緩存清單在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