HTML Attributes
HTML nomodule attribute
Prevents an external classic script from executing in browsers that support JavaScript modules. Used for legacy fallbacks; not needed for ordinary modern module scripts. 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
nomoduleParameters & Attributes
| Name | Type | Description |
|---|---|---|
| nomodule | boolean | Prevents an external classic script from executing in browsers that support JavaScript modules. Used for legacy fallbacks; not needed for ordinary modern module scripts. |
Working Example
Example Snippethtml
<script type="module" src="modern.js"></script><script nomodule src="legacy.js"></script>Browser Compatibility
Minimum supported versions across modern rendering engines
Chrome
61
Yes
Edge
16
Yes
Firefox
60
Yes
Safari
11
Yes
Checked desktop BCD snapshot: nomodule on script. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted.
HTML Living Standard