当前位置:网站首页>记录webView显示空白的又一坑
记录webView显示空白的又一坑
2022-04-23 06:07:00 【独饮敌敌畏丶】
问题描述
今天在app用webView加载网页。突然出现了加载不出来的情况。webView.getUrl()都能得到我要加载的Url。但是就是不显示我要加载的网页。在浏览器上是可以显示的
解决思路
1.因为之前遇到过类似的问题,是证书问题,所以我就看上次的解决方案能否解决。
如图

证书有问题,选择继续加载。
但是,还是没解决
2.各种百度,尝试各种方案
比如
mWebSettings.setDomStorageEnabled(true);//开启本地DOM存储
我以为是html网页太大了,所以我就开启本地DOM存储试试。但是还不行
于是我就想看看缓存行不行
mWebSettings.setAppCacheEnabled(true);//是否使用缓存
事实证明也不行
3.再次冷静,分析问题。
我的webView第一次是可以打开的,但是打开了另外一个页面(也是webView)之后(另外一个页面也是可以打开的),再打开第一次的webView,就加载不出来了。我灵机一动,想会不会是打开另外一个页面的时候,webView没有销毁?
因为公司里的webView用的是自己封装的工具类,可能有的步骤漏掉了。
我去找源代码,果然!
于是我就加了两行。如图

在用户点击返回的时候,手动销毁了webView,同时在返回事件中,也做了销毁,如图

然后再按之前的步骤。
先打开另外一个页面,再打开我最初要打开的页面,发现可以打开了。问题解决!
版权声明
本文为[独饮敌敌畏丶]所创,转载请带上原文链接,感谢
https://blog.csdn.net/afdafvdaa/article/details/122490799
边栏推荐
- oracle数据库将多个列的查询结果集合并到一行中
- BCC installation and basic tool instructions
- Construire un blog Cloud basé sur ECS (bénédiction sur le Code Cloud Xiaobao, explication détaillée de la tâche iphone13 gratuite)
- 第三篇:docker安装mysql容器(自定义端口)
- Static interface method calls are not supported at language level ‘5‘ 异常解决
- Memcached source code analysis
- Antd Design Form表单检验
- 19C RAC修改VIP及SCANIP步骤-同网段
- Build a cloud blog based on ECS (polite experience)
- Dolphinscheduler调度spark任务踩坑记录
猜你喜欢

OSS云存储管理实践(体验有礼)

【机器学习】笔记 4、KNN+交叉验证

双指针仪表盘读数(一)

Try catch cannot catch asynchronous errors

Static interface method calls are not supported at language level ‘5‘ 异常解决

基于ECS搭建云上博客(云小宝码上送祝福,免费抽iphone13任务详解)

Thanos compact component test summary (processing historical data)

Memcached source code analysis

基于ECS搭建云上博客(体验有礼)

OVS and OVS + dpdk architecture analysis
随机推荐
When switch case, concatenate the error case and if of the conventional judgment expression and use L
oracle清除sql的缓存
Practice using polardb and ECs to build portal websites
EMR Based offline data analysis - polite feedback
iTOP4412 SurfaceFlinger(4.4.4_r1)
oracle表的约束详解
测试oracle库700万数据量普通方式创建索引所需时间
Implementation of multi tenant read and write in Prometheus cortex
解决::Argument ‘radius‘ is required to be an integer
oracle中生成32位uuid
js 函数包裹forEach中使用return跳不出外层函数
TC ebpf practice
Using Prom label proxy to implement label based multi tenant reading of Prometheus thanos
Abnormal record-11
oracle表空间表分区详解及oracle表分区查询使用方法
Abnormal record-16
Ali vector library Icon tutorial (online, download)
js 格式化当前时间 日期推算
Error alarm of Postgres master-slave replication delay monitoring
Information:2021/9/29 10:01 - Build completed with 1 error and 0 warnings in 11s 30ms Error异常处理