我已经尝试过多次在webview(https://www.prpal.com/#/)中打开此链接,但所有时间都失败了
此链接在Android或iOS的所有浏览器中均有效。
请有人帮我在Android Studio的webview中打开此链接
webView=(WebView)findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedSslError(WebView view, SslErrorHandler
handler, SslError error) {
handler.proceed();
}
});
webView.loadUrl("https://www.prpal.com/#/");
webView.setWebChromeClient(new WebChromeClient());
}
答案 0 :(得分:2)
我已经测试过,但是发现了问题,您不见了setDomStorageEnabled()
设置在平移或缩放或托管WebView的窗口没有焦点时,WebView是否将启用平滑过渡。如果是这样,WebView将选择一种解决方案以最大化性能。例如WebView的内容在过渡期间可能不会更新。如果为假,则WebView将保持其保真度。默认值为false。
新代码是:
webView=(WebView)findViewById(R.id.wb_test);
webView.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedSslError(WebView view, SslErrorHandler
handler, SslError error) {
handler.proceed();
}
});
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.loadUrl("https://www.prpal.com/#/");
这是输出:
答案 1 :(得分:0)
当我尝试在webView中加载您的URL时,出现了此错误
I/chromium: [INFO:CONSOLE(58)] "Google Maps JavaScript API error: RefererNotAllowedMapError
https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error
Your site URL to be authorized: https://www.prpal.com/#/", source: https://maps.googleapis.com/maps/api/js?key=AIzaSyB46qkQ0B22hLbZW6HX2e8llY2wzHeDqzk&libraries=places (58)
2019-04-17 18:54:17.202 4186-4186/com.psycho.webviewdemo I/chromium: [INFO:CONSOLE(0)] "The resource https://pagead2.googlesyndication.com/pagead/js/r20190415/r20190131/show_ads_impl.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: (0)
为此转到问题[Google Map API key error "Your site URL to be authorized"]