HTML Attributes

HTML defer attribute

Schedules an external classic script to run after parsing and before DOMContentLoaded, in document order. It has no effect on inline classic scripts; modules defer by default unless async is used. Applicable elements include: <script>. Check each element’s value rules. Boolean syntax: presence enables the state; omit the attribute to disable it. A string value of "false" does not turn it off. Example uses illustrative URLs or local assets; provide the corresponding files or application endpoints when running it.

Formal Syntax & Structure

html syntaxhtml
defer

Parameters & Attributes

NameTypeDescription
deferbooleanSchedules an external classic script to run after parsing and before DOMContentLoaded, in document order. It has no effect on inline classic scripts; modules defer by default unless async is used.

Working Example

Example Snippethtml
<script src="app.js" defer></script>

Browser Compatibility

Minimum supported versions across modern rendering engines

Chrome
1
Yes
Edge
12
Yes
Firefox
3.5
Yes
Safari
3
Yes
Checked desktop BCD snapshot: defer on external classic HTML scripts. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted. BCD notes a Chrome XHTML exception and historical Firefox 3.5 inline behavior.
HTML Living Standard
HTML Reference