android 中 webview 怎么用 localStorage
我在android里面使用html5的localStorage
为什么存不进去也读不出来呀?
网上搜了好多都没效果
mainWebView=(WebView)this.findViewById(R.id.mainWebView);
WebSettingssettings=mainWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
settings.setDatabaseEnabled(true);
Stringdir=this.getApplicationContext().getDir("database",Context.MODE_PRIVATE).getPath();
settings.setDatabasePath(dir);
settings.setDomStorageEnabled(true);
settings.setGeolocationEnabled(true);
解决方案:
mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setAppCacheMaxSize(1024*1024*8); StringappCachePath=getApplicationContext().getCacheDir().getAbsolutePath(); mWebView.getSettings().setAppCachePath(appCachePath); mWebView.getSettings().setAllowFileAccess(true); mWebView.getSettings().setAppCacheEnabled(true);
这个测试了是可以的
热门推荐
7 家长会简短祝福语
10 七十年祝福语简短
11 疫情对妈妈祝福语简短
12 母亲祝福语简短微信
13 给弟弟敬茶祝福语简短
14 爸妈对宝宝祝福语简短
15 小姨看孩子祝福语简短
16 朋友侄子结婚祝福语简短
17 班级祝福语简短句子
18 感恩老师祝福语简短独特