2010-12-06 145 views
11

我想添加html 5緩存到一個web應用程序,沒有太複雜的圖像/ css/js。cache.manifest第一次工作然後失敗

當我加載頁面編輯cache.manifest文件,我得到在Chrome 8以下調試後:

Creating Application Cache with manifest http://example.com/themes/zenmobile/cache.manifest 
Application Cache Checking event 
Application Cache Downloading event 
Application Cache Progress event (0 of 26) http://example.com/themes/zenmobile/plugins/img/toolbar.png 
Application Cache Progress event (1 of 26) http://example.com/themes/zenmobile/plugins/img/greenButton.png 
Application Cache Progress event (2 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.transitions.js 
Application Cache Progress event (3 of 26) http://example.com/themes/zenmobile/plugins/img/back_button_clicked.png 
Application Cache Progress event (4 of 26) http://example.com/themes/zenmobile/plugins/img/button.png 
Application Cache Progress event (5 of 26) http://quizible.com/sites/all/modules/jquery_update/replace/jquery.min.js 
Application Cache Progress event (6 of 26) http://example.com/themes/zenmobile/plugins/img/grayButton.png 
Application Cache Progress event (7 of 26) http://example.com/themes/zenmobile/plugins/img/chevron_circle.png 
Application Cache Progress event (8 of 26) http://example.com/themes/zenmobile/plugins/img/on_off.png 
Application Cache Progress event (9 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.js 
Application Cache Progress event (10 of 26) http://example.com/themes/zenmobile/layout.css 
Application Cache Progress event (11 of 26) http://example.com/themes/zenmobile/plugins/img/chevron.png 
Application Cache Progress event (12 of 26) http://example.com/themes/zenmobile/plugins/img/rowhead.png 
Application Cache Progress event (13 of 26) http://example.com/themes/zenmobile/zenmobile.css 
Application Cache Progress event (14 of 26) http://example.com/themes/zenmobile/plugins/img/loading.gif 
Application Cache Progress event (15 of 26) http://example.com/themes/zenmobile/plugins/img/redButton.png 
Application Cache Progress event (16 of 26) http://example.com/themes/zenmobile/plugins/img/activeButton.png 
Application Cache Progress event (17 of 26) http://example.com/themes/zenmobile/images/bg_body.png 
Application Cache Progress event (18 of 26) http://example.com/themes/zenmobile/plugins/theme.css 
Application Cache Progress event (19 of 26) http://example.com/themes/zenmobile/plugins/img/toggle.png 
Application Cache Progress event (20 of 26) http://example.com/themes/zenmobile/plugins/img/whiteButton.png 
Application Cache Progress event (21 of 26) http://example.com/themes/zenmobile/plugins/img/toggleOn.png 
Application Cache Progress event (22 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.css 
Application Cache Progress event (23 of 26) http://example.com/themes/zenmobile/plugins/img/button_clicked.png 
Application Cache Progress event (24 of 26) http://example.com/themes/zenmobile/plugins/img/back_button.png 
Application Cache Progress event (25 of 26) http://example.com/themes/zenmobile/plugins/img/blueButton.png 
Application Cache Progress event (26 of 26) 
Application Cache Cached event 

當我再次刷新頁面,所有的CSS /圖像/ JS無法加載和控制檯日誌噴出:

Document was loaded from Application Cache with manifest http://example.com/themes/zenmobile/cache.manifest 
Application Cache Checking event 
Application Cache NoUpdate event 

隨後的負載「失敗加載資源」

除此之外輸出我還沒有發現任何有用的東西,試圖解決這個問題。有沒有人見過這個?

+0

在cache.manifest文件中是否有任何FALLBACK資源聲明? – 2011-01-02 21:51:39

回答

0

html5清單很難處理。如果它在一個瀏覽器中可能無法正常工作

1)查看資源標籤頁,看看哪個資源導致錯誤(使用螢火蟲或webkit)
2)我發現改變清單名稱每次部署都有助於確保瀏覽器檢測到更改。

0

您是否正在加載不在您的清單文件中的其他資源?嘗試列出所有內容,看看是否繼續存在問題。

19

有同樣的問題。在底部固定它把這個對我來說:

NETWORK: 
* 

而要解決大多數人都與清單更新遇到的問題,這種方法可以很好地表現了我:

貼上清單文件和所有緩存資源在URL中具有版本號,並且還設置清單的內容以引用該版本號。像這樣:

<html manifest="path/to/cache.manifest?v=42"> 

CACHE MANIFEST 
#rev ?v=42 

/css/foo.css?v=42 
/css/bar.css?v=42 
/js/script.js?v=42 

我已經自動化這個對我們來說,這樣一個新的部署我只是1籌集數(某處設置文件,我讀),它是在所有提到的文件中受到影響。每個瀏覽器請求不僅會檢測清單文件更改,還會導致重新加載(並緩存)提及的每個資源,從而更新整個應用程序。

相關問題