2011-07-13 24 views
3

我有有域http://draft.mo2do.com問題,同時做HTML5的web應用程序緩存

,當我訪問它會解決像下面的網址並重定向到相應的網站主頁

http://draft.mo2do.com/s/_91665/Home

URL中的Web應用程序

這裏我實現了脫機緩存。我cache.manifest文件是低於

CACHE MANIFEST 
    # Offline cache v4.0 

    # All other resources (e.g. sites) require the user to be online. 

    NETWORK: 

    * 

    # Additional resources to cache CACHE: 

    # Add the pages in to the cache 

    /s/_91665/Home /s/_91665/CachedDraftBoard 

    http://draft.mo2do.com 

    # Add the images in to the cache 

    /s/store/-1/webapp/styles/webapp.css 

    /s/store/-1/webapp/styles/nba_draft.css 

    /s/store/-1/webapp/styles/add2drafthome.css?v2 

    # Add the js files in to the cache 

    /s/store/-1/webapp/scripts/jquery-1.5.min.js 

    /s/store/-1/webapp/scripts/iscroll.js 

    /s/store/-1/webapp/scripts/webapp.js 

    /s/store/-1/webapp/scripts/nba_draft.js 

    /s/store/-1/webapp/scripts/cacheUpdate.js 

    /s/store/-1/webapp/scripts/add2drafthome.js?v0.9.4 



    /webapp/icon.png /webapp/startup.png 

    /s/store/-1/webapp/nba/addtodrafthome/arrow.png 

    /s/store/-1/webapp/nba/addtodrafthome/close-bubble.png 

    /s/store/-1/webapp/nba/addtodrafthome/icon.png 

    /s/store/-1/webapp/nba/addtodrafthome/plus.png 

    /s/store/-1/webapp/nba/addtodrafthome/share.png 

    FALLBACK: 

    http://draft.mo2do.com 

,如果我直接訪問該網站網址的緩存工作,那個時候我沒有提「http://draft.mo2do.com」在緩存部分。在此期間,脫機緩存工作正常。

如果我在瀏覽器中直接訪問域url「http://draft.mo2do.com」,它不會在脫機模式下打開404。

然後我在高速緩存部添加了「http://draft.mo2do.com」那個時候我收到異常

應用程序高速緩存進展事件(3 2)http://draft.mo2do.com/應用程序高速緩存錯誤事件:資源取失敗(-1)http://draft.mo2do.com/

如果我訪問該域,它也應該在離線模式下加載應用程序。如果我訪問直接URL應用程序加載正常。

我該如何解決這個問題?

回答

0

緩存必須直接引用特定資源,無論是JavaScript,CSS,HTML頁面,圖像,無論如何。從我上面的內容中可以看出,你已經完成了。然而,簡單地在那裏放置域名將不起作用(您還需要參考全部您要離線的頁面,例如/s/_91665/Home需要在那裏)。

所以,有沿線某處錯誤,但很難找出你這個意思:

如果我直接訪問僅域網址「http://draft.mo2do.com 「在瀏覽器中,它不是在離線模式下打開404。

你能更清楚嗎?你的意思是去那個URL導致一個404,或者在頁面本身有什麼東西是錯誤的?

您確定您的緩存文件按預期運行嗎? 如果您的緩存文件中有任何錯誤,您的離線應用程序根本無法工作。本頁提供一些調試代碼,這可能有助於:

Debugging HTML 5 Offline Application Cache

+0

這是當地url.i將在瀏覽器中的「http://draft.mo2do.com」打字啓動我的web應用程序。當我訪問該網址時,它將重定向到http://draft.mo2do.com/s/_91665/Home此網址和緩存頁面,我也在緩存部分中提到過。主頁網址得到緩存,所以當我訪問主頁網址在離線模式下它正在加載。但「http://draft.mo2do.com」urlis沒有得到緩存,你得到了404。如果我添加高速緩存部分中的url我正在獲取資源獲取失敗錯誤。我需要的是當我訪問域的url也應該從離線緩存加載。 – Raja