blob: e220be5098bd43a7fb25886762fd829bed1a2e63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
---
tags:
- html
- web
---
Default type: javascript. Can specify `type` with a mimetype of alternate script language. `type="module"` for javascript modules.
Place scripts at the end rather than at the start, unless [DOMContentLoadedEvent](https://developer.mozilla.org/docs/Web/API/Document/DOMContentLoaded_event) is used.
- Javascript can't reference elements that don't yet exist
- Browser blocks rendering, and halts downloads etc until js finishes execution
`<script defer>` dont block while downloading, execute js after rendering
`<script async>` dont block while downloading, execute js when download finished, pausing renderer until js completes
|