Skip to content

Commit b93f0fc

Browse files
committed
21/04/18
1 parent a3f8dc2 commit b93f0fc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎JavaScript/Js文件异步加载.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
`defer`是早期`IE`支持的属性,目前主流浏览器都已经支持,该属性会使浏览器开启一个线程去加载`Js`并且会在`DOM`结构解析完成之后再执行。
66
* `defer`只适用于外联脚本。
77
* 如果有多个声明了`defer`的脚本,则会按顺序下载和执行。
8-
* `defer`脚本会在`onDOMContentLoaded`之后和`onload`事件之前执行。
8+
* `defer`脚本会在`onDOMContentLoaded`之前执行,当然同样也就在`onload`事件之前执行。
99

1010
```html
1111
<!-- 兼容性 https://caniuse.com/#feat=script-defer -->
@@ -47,5 +47,6 @@ https://github.com/WindrunnerMax/EveryDay
4747
```
4848
https://segmentfault.com/a/1190000006778717
4949
https://www.cnblogs.com/jiasm/p/7683930.html
50+
https://blog.csdn.net/zyj0209/article/details/79698430
5051
https://blog.csdn.net/qq_41245969/article/details/82428464
5152
```

0 commit comments

Comments
 (0)