zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

android 中 webview 怎么用 localStorage? 我在 android里面 使用html5的 localStorage 为什么存不进去也读不出来呀? 网上搜了好多都没效果

Androidwebviewhtml5 怎么 为什么 效果 里面 出来
2023-09-14 08:58:48 时间

解决方案:

mWebView.getSettings().setDomStorageEnabled(true);   
mWebView.getSettings().setAppCacheMaxSize(1024*1024*8);  
String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();  
mWebView.getSettings().setAppCachePath(appCachePath);  
mWebView.getSettings().setAllowFileAccess(true); 
mWebView.getSettings().setAppCacheEnabled(true); 

https://www.jb51.net/article/67044.htm