问题描述:
在开发过程中发现oppo 5.x版本的手机加载H5页面无法加载,在默认浏览器打开会提示证书安全,要点击继续才能正常访问,但是直接用AgentWeb打开无任何提示,导致页面无法加载
解决方案:
重写WebViewClient的onReceivedSslError方法
private fun getWebViewClient(): com.just.agentweb.WebViewClient {
return object : com.just.agentweb.WebViewClient() {
override fun onReceivedSslError(
view: WebView?,
handler: SslErrorHandler,
error: SslError?
) {
handler.proceed()
}
}
}
调用:
AgentWeb.with(this).setWebViewClient(getWebViewClient())
网友评论