Github.com/gzsll/WebVi… Note: Adding the following code will block JS communication. Disable jsBridge. Bear in mind that
webView.setWebViewClient(new WebViewClient() {// Will block jsBridge
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
LogUtils.d("onReceivedSslError"."Page load SSL onReceivedSslError =" + error.toString());
handler.proceed();// Ignore the certificate error and continue to Load the page without displaying a blank page}});Copy the code
If you really want to add the following:
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
if (error.getPrimaryError() == SslError.SSL_DATE_INVALID // The date is incorrect
|| error.getPrimaryError() == SslError.SSL_EXPIRED // The date is incorrect
|| error.getPrimaryError() == SslError.SSL_INVALID // webview BUG
|| error.getPrimaryError() == SslError.SSL_UNTRUSTED) { // The root certificate is lost
if (chkMySSLCNCert(error.getCertificate())) {
handler.proceed(); // If the certificates are consistent, ignore the error}}} ` ` ` principle analysis: through the assets under the library/WebViewJavascriptBridge js then rewrite: WVJBWebView(Webview), WVJBWebViewClient (WebViewClient) to implement.Copy the code