当前位置:网站首页>记录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
边栏推荐
猜你喜欢

阿里矢量库的图标使用教程(在线,下载)

统一任务分发调度执行框架

Chaos vous emmène au projet chaos.

Information:2021/9/29 10:01 - Build completed with 1 error and 0 warnings in 11s 30ms Error异常处理

基於ECS搭建雲上博客(雲小寶碼上送祝福,免費抽iphone13任務詳解)

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

oracle undo使用率高问题处理

Prometheus thanos Quick Guide

AVD Pixel_2_API_24 is already running.If that is not the case, delete the files at C:\Users\admi

Explore how @ modelandview can forward data and pages through the source code
随机推荐
JS format current time and date calculation
个人学习相关
基于ECS搭建云上博客(体验有礼)
VirtualBox如何修改“网络地址转换(NAT)”网络模式下分配给虚拟机的IP网段
qs.stringify 接口里把入参转为&连接的字符串(配合application/x-www-form-urlencoded请求头)
关于我
利用队列实现栈
iTOP4412 HDMI显示(4.4.4_r1)
oracle杀死正在执行的sql
Prometheus monitoring method and index interpretation of influxdb
个人博客网站搭建
iTOP4412 FramebufferNativeWindow(4.0.3_r1)
Using Prom label proxy to implement label based multi tenant reading of Prometheus thanos
Redis FAQ
Research on alertmanager repeated / missing alarm phenomenon and two key parameters_ Wait and group_ Interpretation of interval
Django::Did you install mysqlclient?
阿里矢量库的图标使用教程(在线,下载)
解决:You have 18 unapplied migration(s). Your project may not work properly until you apply
oracle表空间表分区详解及oracle表分区查询使用方法
org.xml.sax.SAXParseException; lineNumber: 141; columnNumber: 252; cvc-complex-type.2.4.a: 发现了以元素 ‘b