Firefox Tomorrow

web api instance property

HTMLScriptElement: defer property

View on MDN ↗

The defer property of the HTMLScriptElement interface is a boolean value that controls how the script should be executed. For classic scripts, if the defer property is set to true, the external script will be executed after the document has been parsed, but before firing DOMContentLoaded event. For module scripts, the defer property has no effect.

It reflects the defer attribute of the <script> element.

Value

A boolean.

Examples

<script id="el" src="/example.js" defer></script>
const el = document.getElementById("el");
console.log(el.defer); // Output: true

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also