How to Use localStorage for webview in android
This article describes how to use the localStorage Method for webview in android. For more information, see
I use localStorage of html5 in android
Why can't I read it if I can't store it?
It is ineffective to search a lot on the Internet.
? MainWebView = (WebView) this. findViewById (R. id. mainWebView );
WebSettings settings = mainWebView. getSettings ();
Settings. setJavaScriptEnabled (true );
Settings. setAllowFileAccess (true );
Settings. setDatabaseEnabled (true );
String dir = this. getApplicationContext (). getDir ("database", Context. MODE_PRIVATE). getPath ();
Settings. setDatabasePath (dir );
Settings. setDomStorageEnabled (true );
Settings. setGeolocationEnabled (true );
Solution:
?
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 );
This test is acceptable.