我有一个 Web 应用程序,其域名为 http://draft.mo2do.com。
当我访问该 URL 时,它将解析为以下 URL,并重定向到相应网站的首页。
http://draft.mo2do.com/s/_91665/Home
我在这里实现了离线缓存。我的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
如果我直接访问网站的URL,则缓存会起作用,这时我没有在缓存部分中提到“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,则应用程序会正常加载。
如何解决这个问题?