美文网首页
2020-03-11 AgentWeb在部分手机上无法加载H5的

2020-03-11 AgentWeb在部分手机上无法加载H5的

作者: 兣甅 | 来源:发表于2020-03-11 15:41 被阅读0次

    问题描述:

    在开发过程中发现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())
    

    相关文章

      网友评论

          本文标题:2020-03-11 AgentWeb在部分手机上无法加载H5的

          本文链接:https://www.haomeiwen.com/subject/tmvcjhtx.html