xdu*_*ine 9 android caching android-webview
我有一个使用应用程序缓存的webview.我启动了与网络连接的应用程序,以加载/缓存页面.现在,在关闭wifi(和3g - 没有网络连接)并启动应用程序后,我会看到"android无法加载页面"页面.奇怪的是,如果我重新加载webview,它会从缓存中加载页面.如果无法连接到网络,为什么不从缓存中加载此页面?
我正在使用带有cache.manifest的HTML5 Application Cache.这是我的webview代码,用于启用此功能:
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setAppCacheMaxSize(1024*1024*8);
webview.getSettings().setAppCachePath("/data/data/com.my.package/cache");
webview.getSettings().setAllowFileAccess(true);
webview.getSettings().setAppCacheEnabled(true);
Run Code Online (Sandbox Code Playgroud)
我试过加入:
weview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
Run Code Online (Sandbox Code Playgroud)
但它没有帮助.
| 归档时间: |
|
| 查看次数: |
2756 次 |
| 最近记录: |