← BYTES
HTML·Intermediate·Ref: 2.2.4
What does the `defer` attribute do when added to a `<script>` tag?
Have a question about this video? Mention reference 2.2.4 when you contact us.
a.It tells the browser to continue parsing the HTML document in parallel with downloading the script, and only execute the script after parsing completes -- avoiding blocking page rendering
b.It prevents the script from ever running
c.It makes the script run before the HTML document even starts loading
d.It is only usable with inline scripts, never external ones
Without defer (or async), a <script> tag blocks HTML parsing while it downloads and executes synchronously. defer lets the browser keep parsing the rest of the document while the script downloads in the background, then runs the script (in source order among other deferred scripts) only once parsing completes, right before DOMContentLoaded.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES224#HTML