Android WebView SSL 'Security Warning'

前端 未结 2 599
旧时难觅i
旧时难觅i 2021-01-11 23:52

I\'m building a test version of an app for a client. Part of this app uses a WebView that calls out to a SSL-based site. In turn, the client has provided a test domain where

2条回答
  •  攒了一身酷
    2021-01-12 00:19

    Create a WebViewClient and handle the onReceivedSslError which looks like this:

    public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error)
    

    Inside this callback you can just call handler.proceed() and the page will continue loading. If you don't handle this callback and call the proceed() method then the default behaviour will be for the page not to load.

提交回复
热议问题