我尝试在android WebView中显示此url,但未在WebViewClient回调onReceivedError中收到任何错误。但是,看来js文件中有问题,下面的日志已写入。如何解决此问题或在应用程序中显示此URL?
I /铬:[INFO:CONSOLE(1)]“未捕获的TypeError:无法读取null的属性'theme'”,来源:https://tronscan.org/static/js/vendors.9044c224.js(1)
<WebView android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
@BindView(R.id.webview) WebView eWebview;
eWebview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
if(progress == 100 && !isLoaded) {
Log.i(TAG, "Progress:"+progress);
isLoaded = true;
}
}
});
eWebview.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show();
}
});
WebSettings webSettings = eWebview.getSettings();
webSettings.setJavaScriptEnabled(true);
eWebview.loadUrl("https://tronscan.org/#/transaction/e760f270b2f44658019f4a24ebc1b797f3adb1e6f6725a80475d5c96f0d6bc83");
答案 0 :(得分:1)
您可以尝试
webSettings.setDomStorageEnabled(true);
来源Android Webview: "Uncaught TypeError: Cannot read property 'getItem' of null"