Link Relationships

HTML rel="modulepreload"

Fetches a JavaScript module in advance and prepares it in the module map without evaluating it. Credentials and module request settings must match subsequent use. The example belongs in a document head; resource URLs are illustrative. Supply actual resources and server configuration to observe network behavior.

Formal Syntax & Structure

html syntaxhtml
<link rel="modulepreload" href="/app.js">

Parameters & Attributes

NameTypeDescription
relspace-separated relationship tokensInclude modulepreload on an element that supports this relationship.
hrefURL or fragmentIdentifies the linked destination or resource.
crossoriginanonymous or use-credentialsControls eligible request credential settings. Match the actual use; font preloads require crossorigin.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>Example</title>    <link rel="modulepreload" href="/app.js">  </head>  <body>    <p>Example document</p>  </body></html>

Browser Compatibility

Minimum supported versions across modern rendering engines

Widely Available (2023)
Blink (modern)
Chrome
66
Yes
Gecko
Firefox
115
Yes
WebKit
Safari
17
Yes
Basic modulepreload; additional resource destinations have their own support. Edge and Opera mirror rows unresolved.
HTML Living Standard
HTML Reference