当前位置:网站首页>【学习笔记】网页出现白屏可能的原因与优化方法
【学习笔记】网页出现白屏可能的原因与优化方法
2022-07-24 05:38:00 【曾胖神父】
问题描述
页面白屏,具体情况如下
页面白屏的主要原因是页面渲染被阻塞
渲染阻塞的原因
可能是因为CSS加载出现阻塞,然后又因为CSS在headb标签内,导致只有加载完CSS,才能显示内容,然而CSS出于某种原因加载出现阻塞,导致后面的内容无法渲染,从而使整个页面变为白屏。
也有可能是JS加载出现阻塞,从而导致页面无法解析。最后导致整个页面变为白屏。
优化办法
优化的最佳办法,那肯定直接优化CSS,JS体积,从而从根本上解决加载缓慢,加载阻塞的问题
除此之外,讨巧的办法就是将大体积的CSS和JS放入到body最尾部,然后将少量用于定位等基本样式的CSS放入头部,保证页面会先将页面基本样式和元素加载出来,然后加载JS的Script标签还可以加入async,defer属性,使JS的加载变为异步加载,这样JS的加载就不会阻塞页面解析了
边栏推荐
- Sealos 打包部署 KubeSphere 容器平台
- 【音频解码芯片】VS1503音频解码芯片的应用
- String问题
- Today, let's talk about the underlying architecture design of MySQL database. How much do you know?
- Redis基本类型-哈希Hash
- [media controller] open source project learning notes (based on Arduino micro development board)
- 【LVGL】组件的样式的设置、更改、删除API函数
- JS: why [] = =! [] return true?
- [jQuery自定义插件] 1 自定义缓存插件-jQueryCache
- [audio decoding chip] Application of vs1503 audio decoding chip
猜你喜欢
![[lvgl (4)] event and event bubble of the object](/img/1e/9fe3d34f5f8d8c7298a106dca8d949.png)
[lvgl (4)] event and event bubble of the object

【音频解码芯片】VS1503音频解码芯片的应用

LM393 电压比较器及其典型电路介绍

Special effects - when the mouse moves, stars appear to trail

DNS domain name resolution service
![[lvgl (1)] a brief introduction to lvgl](/img/2e/2e155f1d3669c27ad1b090ca954224.png)
[lvgl (1)] a brief introduction to lvgl

Sort by an attribute value of an object in the array

JSONObject按照key的A——Z顺序排序

Why can't index be the key of V-for?

类的加载器 和 双亲委派机制详解
随机推荐
Redis data type - list list
机器学习案例:孕妇吸烟与胎儿健康
System safety and Application
oss授权单个bucket权限
Directory and file management
Neural network superparameter adjustment (based on ray package)
Esp32 ultra detailed learning record: NTP synchronization time
Jenkins CI CD
kubernetes 的Deployment(部署),Service概念,动态扩缩容
Talk about strong cache and negotiation cache
Restful API introduction
JS: why [] = =! [] return true?
File system and log analysis
【LVGL(4)】对象的事件及事件冒泡
我有 7种 实现web实时消息推送的方案,7种!
基于回归分析的广告投入销售额预测——K邻近,决策树,随机森林,线性回归,岭回归
Why can't index be the key of V-for?
Redis基本类型-哈希Hash
JSONObject按照key的A——Z顺序排序
在IDEA里斗个地主不过分吧!