search

Home  >  Q&A  >  body text

Best caching strategy for hybrid for html

Apes with magical powers. I would like to ask everyone about your requirements when making hybrid applications: (The most ideal situation is) the loaded HTML page will always be the latest.
But in fact there are the following problems:

1.使用NSURLRequestUseProtocolCachePolicy这个缓存策略,会先去访问服务器,如果是304状态码,则加载缓存中的,否则,从服务器中请求最新的。------我一直觉得这个是最理想的方案,离理想中的方案最接近。但是有两个问题:
问题1:在请求状态码的时候还是需要发起一次请求。也就是说,在无网络的情况,是无法显示页面的。或者说请求超时也是无法加载页面的。
问题2:再就是如果页面很大,网速很慢的话体验是非常不好的。
2.为了解决上面两个问题,也许你可能会说可以先下载到本地,然后加载本地的html网页。但是,下载到本地这部分功能如何实现检察更新呢?有没有这样的第三方库,有的话就不做了。没有的话正打算做一个。大家觉得怎么样才合理呢?
phpcn_u1582phpcn_u15822842 days ago648

reply all(0)I'll reply

No reply
  • Cancelreply