In Android, WebView is a control used to load HTTP and HTTPS Web pages to local applications. By default, the Loadurl (String URL) method allows you to successfully load pages such as http://www.baidu.com. However, when the HTTPS page with the SSL layer is load, such as https://money.183.com.cn/, if the site's security certificate is not authenticated on Android, WebView becomes a blank page, It doesn't jump out of a risk box like a PC browser. Therefore, we must deal with this situation.
Android has two classes to deal with
Copy Code code as follows:
Import Android.net.http.SslError;
Import Android.webkit.SslErrorHandler;
The specific usage is as follows:
Copy Code code as follows:
WebView WV = (webview) Findviewbyid (R.id.webview);
Wv.setwebviewclient (New Webviewclient () {
public void Onreceivedsslerror (WebView view, Sslerrorhandler handler, sslerror error) {
Handler.cancel (); Default processing, webview into blank pages
Handler.process (); Accept Certificate
Handlemessage (msg); Other processing
}
If you simply accept all the certificates, then you can directly adjust the process () method.