HTML as Attribute
The as attribute sets the type of content a <link rel="preload"> fetches, such as script, style, font or image, so it gets the right priority.
Description
The as attribute of the <link> element tells the browser what type of resource is being fetched when rel="preload" or rel="modulepreload" is used. It is required for preloading: without a valid as value the browser cannot set the correct priority, request headers and Content Security Policy, and may download the resource twice.
The value must match how the resource will later be used, for example style for a stylesheet, script for a script, font for a web font (which also needs the crossorigin attribute) and image for an image.
Syntax
<link rel="preload" href="URL" as="type">
Values
- audio, video, trackMedia files and text tracks.
- documentAn HTML document to embed in a frame.
- embed, objectResources for <embed> and <object>.
- fetchA resource fetched with fetch() or XMLHttpRequest.
- fontA web font.
- imageAn image.
- scriptA JavaScript file.
- styleA CSS stylesheet.
- workerA worker script.
Applies To
Example
Browser Support
The following information will show you the current browser support for the HTML as attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.
Desktop





Tablets & Mobile





