Expand description
Attribute names for script (<script>) elements.
§Purpose
The <script> element embeds or references executable JavaScript code,
enabling client-side scripting and dynamic behavior in web pages.
§Common Attributes
src: URL of external script filetype: MIME type or module type (“text/javascript”, “module”)async: Load and execute asynchronouslydefer: Defer execution until document is parsedintegrity: Subresource integrity hash for securitycrossorigin: CORS settings for external scripts
§Example
<script src="script.js"></script>
<script src="script.js" defer></script>
<script src="script.js" async></script>
<script type="module" src="app.js"></script>
<script src="https://cdn.example.com/lib.js"
integrity="sha384-..."
crossorigin="anonymous"></script>
<script>
console.log('Inline JavaScript');
</script>§WHATWG Specification
Constants§
- ASYNC
- The
asyncattribute. - CROSSORIGIN
- The
crossoriginattribute. - DEFER
- The
deferattribute. - INTEGRITY
- The
integrityattribute. - NOMODULE
- The
nomoduleattribute. - REFERRERPOLICY
- The
referrerpolicyattribute. - SRC
- The
srcattribute. - TYPE
- The
typeattribute.