我想在webView和CordovaWebView之间的活动中共享数据。 CordovaWebView当然使用webView,这就是为什么我不明白为什么我的phoneGap应用程序中存储在localStorage中的数据在简单的webView中不可见,它从主应用程序的相同位置加载html页面。我已经研究了由CordovaWebView存储的数据存储在文件/app_webview /本地存储/ file__0.localstorage和web视图中创建的实例存储的数据类存储在文件/app_webview /本地存储/ __0.localstorage这就是为什么我无法访问数据。 我加载脚本存储在localStorage的数据webView的是这样的:通过webView和CordovaWebView共享localStorage android
webView.loadUrl("file:///android_asset/www/script.html");
在CordovaWebView
首页以同样的方式被载入:
void loadUrlNow(String url) {
if (LOG.isLoggable(LOG.DEBUG) && !url.startsWith("javascript:")) {
LOG.d(TAG, ">>> loadUrlNow()");
}
if (url.startsWith("file://") || url.startsWith("javascript:") || Config.isUrlWhiteListed(url)) {
super.loadUrl(url);
}
}
其中URL是
file:///android_asset/www/index.html
那么为什么在CordovaWebView localStorage保存在文件
/app_webview/Local Storage/file__0.localstorage
而在网页视图文件
/app_webview/Local Storage/__0.localstorage