当前位置:网站首页>webView因证书问题显示一片空白
webView因证书问题显示一片空白
2022-04-23 06:07:00 【独饮敌敌畏丶】
问题现象
webview
一片空白,而各种浏览器都可以访问此url。但是会提示证书不安全的问题
解决思路
因为不管是手机访问,还是浏览器访问,都会提示证书问题,而
webview
有一个setWebViewClient(new MyWebViewCliecnt())
方法,当webview
加载的网页出现证书问题的时候,就会回调MyWebViewCliecnt
的
@Override
public void onReceivedSslError(final WebView view, final SslErrorHandler handler, SslError error) {
}
方法。同时会默认执行handler.cancel()
方法,如图
WebViewClient
在调用了上面的 SslErrorHandler
的 cancel
方法以后,就马上会回调 onPageFinished
方法,不会回调 onReceivedError
,所以也就不会展示自定义的加载错误页面,结果就是一片空白了。
而我们要做的,就是重写onReceivedSslError
方法,并执行handler.proceed()
,表示如果证书不对,还是选择进入网页
如图
这样就可以进入了。
版权声明
本文为[独饮敌敌畏丶]所创,转载请带上原文链接,感谢
https://blog.csdn.net/afdafvdaa/article/details/122085373
边栏推荐
- 基于EMR离线数据分析-反馈有礼
- Comparison between Prometheus thanos and cortex components
- Prometheus monitoring method and index interpretation of influxdb
- TC ebpf practice
- 利用栈实现队列的出队入队
- Abnormal record-12
- oracle库恢复数据
- oracle生成毫秒级时间戳
- JS function package foreach use return can not jump out of the outer function
- iTOP4412内核反复重启
猜你喜欢
随机推荐
Tiny4412 HDMI显示
组件化学习
Oracle锁表查询和解锁方法
oracle undo使用率高问题处理
JS function package foreach use return can not jump out of the outer function
Static interface method calls are not supported at language level ‘5‘ 异常解决
PG SQL截取字符串到指定字符位置
select命令产生redo日志问题的分析
Chaos takes you to the chaos project quickly
Exception record-5
oracle分区的相关操作
Dolphinscheduler集成Flink任务踩坑记录
Relabel of Prometheus_ Configs and metric_ relabel_ Configs explanation and usage examples
Dolphinscheduler调度spark任务踩坑记录
js时间获取本周一、周日,判断时间是今天,今天前、后
基於ECS搭建雲上博客(雲小寶碼上送祝福,免費抽iphone13任務詳解)
iTOP4412内核反复重启
oracle清除sql的缓存
Abnormal record-16
Abnormal record-22