Loading SSL web pages in WebView is normal and not difficult. But if there is a problem with the certificate of the SSL page to be loaded, such as expired, incorrect information, the issuing authority is not trusted, etc., WebView will refuse to load the page. The browser on the PC will pop up a certificate error dialog box, asking you if you want to ignore the error and continue browsing. In fact, this can be done in WebView to achieve the page with the problem loading the certificate.
WebView webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
// *** NEVER DO THIS!!! ***
// super.onReceivedSslError(view, handler, error);
// let's ignore ssl error
}
}
Simply overload the WebViewClient's onReceivedSslError() function like this and execute handler.proceed() in it to ignore the SSL certificate error and continue loading the page.