HTMLScriptElement

The interface for <script>. Extends HTMLElementElement.

Reflected properties

All setters are guarded and throw NoModificationAllowedError on a read-only document.

Property Attribute Type Notes
src src string Reflects verbatim — no base-URL resolution.
type type string Reflects the content attribute verbatim.
defer defer boolean (presence) Reading reflects whether the attribute is present; writing false removes it, any other value sets it present.
async async boolean (presence) Reading reflects whether the attribute is present; writing false removes it, any other value sets it present.
noModule nomodule boolean (presence) Reading reflects whether the attribute is present; writing false removes it, any other value sets it present.
crossOrigin crossorigin nullable enum Keywords: anonymous · use-credentials. Missing attribute → null; any other present value → "anonymous"; assigning null removes the attribute.
referrerPolicy referrerpolicy enum Keywords: "" · no-referrer · no-referrer-when-downgrade · same-origin · origin · strict-origin · origin-when-cross-origin · strict-origin-when-cross-origin · unsafe-url. Missing → ""; invalid → "".

See also