How to access certificate-problematic SSL Web pages in Android _android

Source: Internet
Author: User
Tags ssl certificate

The browser on your PC will eject the Certificate error dialog box, prompting you to continue browsing without ignoring the error. You can actually do this in webview to implement a page that has problems loading the certificate.

Copy Code code as follows:

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
Handler.proceed ();
}
}

Simply overload the Webviewclient onreceivedsslerror () function like this and execute handler.proceed () in it, ignoring the SSL certificate error and continuing loading the page.

Note here that you should never call Super.onreceivedsslerror (). This is because Webviewclient's Onreceivedsslerror () function contains a handler.cancel () (see source, which means stop loading, so if you call Super.onreceivedsslerror (), The result is that the first access cannot be loaded, the second can be loaded (not knowing why), and a libc segment error may occur:

Copy Code code as follows:

A/libc:fatal Signal (SIGSEGV) at 0x00000010 (code=1)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.