欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

android 中 webview 怎么用 localStorage

 更新時(shí)間:2015年07月05日 10:55:50   投稿:hebedich  
這篇文章主要介紹了android 中 webview 怎么用 localStorage方法的相關(guān)資料,需要的朋友可以參考下

我在 android里面 使用html5的 localStorage
為什么存不進(jìn)去也讀不出來(lái)呀?
網(wǎng)上搜了好多都沒(méi)效果

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);

解決方案:

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); 

這個(gè)測(cè)試了是可以的

相關(guān)文章

最新評(píng)論