In Android, WebView is a control used to load http and https web pages to local applications. By default, by loadUrl(String url) method, you can successfully load pages such as, etc. However, when loading an https page with an ssl layer, such as https://money./, if the security certificate of this website cannot be authenticated on Android, the WebView will become a blank page, and a risk warning box will not pop up like in the PC browser. Therefore, we have to deal with this situation.
Android processing requires two classes
Copy the codeThe code is as follows:
import ;
import ;
The specific usage is as follows:
Copy the codeThe code is as follows:
WebView wv = (WebView) findViewById();
(new WebViewClient(){
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){
//(); The default processing method, WebView becomes blank page
//(); Accept the certificate
//handleMessage(Message msg); Other processing
}
If you simply accept all certificates, just click the process() method.