做html5 webapp缓存时出现问题 [英] Problem While Doing html5 webapp cache

查看:199
本文介绍了做html5 webapp缓存时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个webapp,其域名为 http://draft.mo2do.com

I have a webapp which has the domain http://draft.mo2do.com

当我访问网址时,它将像下面的网址一样解析并重定向到相应的网站主页

when i am accessing the url it will resolve like the below url and redirect to the corresponding site home page

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

这里我实现了离线缓存。我的cache.manifest文件如下所示

Here i implemented offline cache. My cache.manifest file is the below

   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。在这段时间离线缓存工作正常。

If i am directly accessing the site url the caching is working and that time i didnt mention the "http://draft.mo2do.com" in the cache section.During this time offline cache is working fine.

如果我直接在浏览器中只访问域URLhttp://draft.mo2do.com,它在离线模式下没有打开404.

If i directly access only the domain url "http://draft.mo2do.com" in the browser it is not opening 404 in the offline mode.

然后我添加了http ://draft.mo2do.com在缓存部分,我得到异常的时间

Then i added the "http://draft.mo2do.com" in the cache section that time i am getting exception

应用程序缓存进度事件(2/3) http://draft.mo2do.com/ 应用程序缓存错误事件:资源提取失败(-1) http://draft.mo2do.com/

Application Cache Progress event (2 of 3) http://draft.mo2do.com/ Application Cache Error event: Resource fetch failed (-1) http://draft.mo2do.com/

如果我也访问域名,它应该在离线模式下加载应用程序。如果我访问直接网址应用程序加载正常。

If i access the domain also it should load the app in the offline mode. If i access direct url app is loading fine.

如何解决此问题?

推荐答案

缓存必须直接引用特定资源,无论是Javascript,CSS,HTML页面,图像等等。从我上面的内容可以看出,你已经做到了。简单地将域放在那里是行不通的(您还需要引用所有的离线页面,例如 / s / _91665 / Home 需要在那里。)

The cache has to directly reference specific resources, be they Javascript, CSS, HTML pages, images, whatever. From what I can tell from the content above, you've done that. Simply placing a domain in there however won't work (you also need to reference all of the pages you want off-line, e.g. /s/_91665/Home needs to be in there).

所以,沿线某处出现了错误,但很难弄明白你的意思:

So, there's an error somewhere along the line, but it's hard to figure out what you mean by this:


如果我在浏览器中直接访问域urlhttp://draft.mo2do.com,则不会在离线状态下打开404模式。

If i directly access only the domain url "http://draft.mo2do.com" in the browser it is not opening 404 in the offline mode.

你能更清楚吗?你是说转到那个URL导致404,或者页面本身有什么错误吗?

Can you be more clear? Do you mean that going to that URL results in a 404, or is there something in the page itself that's in error?

你确定你的缓存文件是否正常运行意? 如果您的缓存文件中存在任何错误,则您的离线应用程序将无法正常工作。这个页面提供了一些可能有用的调试代码:

Are you sure that your cache file is functioning as intended? If there are any errors at all in your cache file, your off-line application simply won't work. This page offers some debugging code which may help:

调试HTML 5离线应用程序缓存

这篇关于做html5 webapp缓存时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆