如何编写网页的缓存? [英] How to write webpage to cache?

查看:139
本文介绍了如何编写网页的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要加载网页,如果在此之前已经加载,而不是修改再从缓存中加载它。如果发现被修改,然后在高速缓存中清除该页面并重新加载。

I want to load a webpage, and if it was already loaded before and not modified then load it from cache. If it is found to be modified, then clear this page in the cache and reload.

我怎样才能做到这一点?

How can I do this?


  1. 写网页到缓存

  2. 找到在缓存
  3. 网页
  4. 显示从缓存
  5. 网页
  6. 清除缓存,如果页面被修改加载新版本

请帮助我。这将是真棒,如果能告诉我的code每个以上。结果
最好的问候。

Please help me. It would be awesome if can show me the code for each of the above.
Best regards.

推荐答案

您可以使用此链接到网页视图缓存保存到SD卡

You can use this link to save the webview cache to the SD-Card

<一个href=\"http://www.devahead.com/blog/2012/01/saving-the-android-webview-cache-on-the-sd-card/comment-page-1/#comment-204\" rel=\"nofollow\">http://www.devahead.com/blog/2012/01/saving-the-android-webview-cache-on-the-sd-card/comment-page-1/#comment-204

和然后在网页视图的属性设置为如下:

and then in the properties of the webview set it as follow:

webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

这篇关于如何编写网页的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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