问题描述
您好我试着与我的Android设备缓存我的Web应用程序。我什么都试过,但没有将工作。缓存将不仅在Android设备上,而不是在其他设备上刷新!下面你看到所有的设置我已经设置缓存的Web应用程序。
Hello I tried to cache my web application with my android device. I tried everything but nothing will work. The Cache will not refresh only on android devices and not on other devices! Below you see all the settings I've set to cache the web application.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
web = (WebView) findViewById(R.id.webview);
web.setWebViewClient(new myWebClient());
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setCacheMode(web.getSettings().LOAD_NORMAL);
web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
web.getSettings().setUserAgentString(getString(R.string.user_agent_suffix));
web.getSettings().setAppCachePath("http://192.168.0.62/lastversion/cache.manifest");
web.getSettings().setAllowFileAccess(true);
web.getSettings().setAppCacheEnabled(true);
web.getSettings().setDomStorageEnabled(true);
web.loadUrl("http://192.168.0.62/lastversion/");
}
在这里我把我的缓存:
here I set my cache:
<html manifest="cache.manifest">
我希望有人能帮助我。谢谢
I hope someone can help me. Thanks
推荐答案
web.getSettings()。setAppCachePath()设置的本地目录中存储缓存文件不是从哪里装载清单。
web.getSettings().setAppCachePath() set's the local directory where to store the cached files not where to load the manifest from.
清单已在HTML文件中引用要缓存:
The manifest has to be referenced in the HTML file you want to cache:
<html manifest="cache.manifest">
你是什么意思有:缓存不仅会在Android设备上,而不是在其他设备上刷新!
缓存的文件只有在清单的内容已经改变将被更新。
的
这篇关于HTML5缓存的问题与Android的WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!