This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The HTMLLinkElement interface represents reference information for external resources and the relationship of those resources to a document and vice versa (corresponds to <link> element; not to be confused with <a>, which is represented by HTMLAnchorElement). This object inherits all of the properties and methods of the HTMLElement interface.
Inherits properties from its parent, HTMLElement.
HTMLLinkElement.asA string representing the type of content being loaded by the HTML link when rel="preload" or rel="modulepreload".
HTMLLinkElement.blockingA string indicating that certain operations should be blocked on the fetching of an external resource. It reflects the blocking attribute of the <link> element.
HTMLLinkElement.crossOriginA string that corresponds to the CORS setting for this link element. See CORS settings attributes for details.
HTMLLinkElement.disabledA boolean value which represents whether the link is disabled; currently only used with style sheet links.
HTMLLinkElement.fetchPriorityAn optional string representing a hint given to the browser on how it should prioritize fetching of a preload relative to other resources of the same type. If this value is provided, it must be one of the possible permitted values: high to fetch at a higher priority, low to fetch at a lower priority, or auto to indicate no preference (which is the default).
HTMLLinkElement.hrefA string representing the URI for the target resource.
HTMLLinkElement.hreflangA string representing the language code for the linked resource.
HTMLLinkElement.imageSizesA string reflecting the imagesizes HTML attribute; a list of comma-separated image conditions and sizes.
HTMLLinkElement.imageSrcsetA string reflecting the imagesrcset HTML attribute; a comma-separated list of image candidate strings.
HTMLLinkElement.integrityA string that contains inline metadata that a browser can use to verify that a fetched resource has been delivered without unexpected manipulation. It reflects the integrity attribute of the <link> element.
HTMLLinkElement.mediaA string representing a list of one or more media formats to which the resource applies. It reflects the media attribute of the <link> element.
HTMLLinkElement.referrerPolicyA string that reflects the referrerpolicy HTML attribute indicating which referrer to use.
HTMLLinkElement.relA string representing the forward relationship of the linked resource from the document to the resource.
HTMLLinkElement.relList Read only
A DOMTokenList that reflects the rel HTML attribute, as a list of tokens.
HTMLLinkElement.sizes Read only
A DOMTokenList that reflects the sizes HTML attribute, as a list of tokens.
HTMLLinkElement.sheet Read only
Returns the StyleSheet object associated with the given element, or null if there is none.
HTMLLinkElement.typeA string representing the MIME type of the linked resource.
HTMLLinkElement.charset Deprecated
A string representing the character encoding for the target resource.
HTMLLinkElement.rev Deprecated
A string representing the reverse relationship of the linked resource from the resource to the document.
Note: Currently the W3C HTML 5.2 spec states that rev is no longer obsolete, whereas the WHATWG living standard still has it labeled obsolete. Until this discrepancy is resolved, you should still assume it is obsolete.
HTMLLinkElement.target Deprecated
A string representing the name of the target frame to which the resource applies.
No specific method; inherits methods from its parent, HTMLElement.
| Specification |
|---|
| HTML> # htmllinkelement> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
HTMLLinkElement |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
as |
50 | 17 | 56 | 37 | 10 | 50 | 56 | 37 | 10 | 5.0 | 50 | 10 |
blocking |
105 | 105 | No | 91 | 18.2 | 105 | No | 72 | 18.2 | 20.0 | 105 | 18.2 |
charset |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
crossOrigin |
34 | 17 | 18 | 21 | 10 | 34 | 18 | 21 | 10 | 2.0 | 37 | 10 |
disabled |
1In Chrome and other Blink-based browsers, adding thedisabled attribute using JavaScript does not remove the stylesheet from document.styleSheets. |
12Since Edge 79, adding thedisabled attribute using JavaScript does not remove the stylesheet from document.styleSheets. |
1 | ≤12.1In Chrome and other Blink-based browsers, adding thedisabled attribute using JavaScript does not remove the stylesheet from document.styleSheets. |
1 | 18In Chrome Android and other Blink-based browsers, adding thedisabled attribute using JavaScript does not remove the stylesheet from document.styleSheets. |
4 | ≤12.1In Chrome and other Blink-based browsers, adding thedisabled attribute using JavaScript does not remove the stylesheet from document.styleSheets. |
1 | 1.0In Chrome and other Blink-based browsers, adding thedisabled attribute using JavaScript does not remove the stylesheet from document.styleSheets. |
4.4In WebView Android and other Blink-based browsers, adding thedisabled attribute using JavaScript does not remove the stylesheet from document.styleSheets. |
1 |
fetchPriority |
102101–102 | 102101–102 | 132 | 8887–88 | 17.2 | 102101–102 | 132 | 70 | 17.2 | 19.0 | 102101–102 | 17.2 |
href |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
hreflang |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
imageSizes |
73 | 79 | 78 | 60 | 17.2 | 73 | 79 | 52 | 17.2 | 11.0 | 73 | 17.2 |
imageSrcset |
73 | 79 | 78 | 60 | 17.2 | 73 | 79 | 52 | 17.2 | 11.0 | 73 | 17.2 |
integrity |
45 | 17 | 43 | 32 | 11.1 | 45 | 43 | 32 | 11.3 | 5.0 | 45 | 11.3 |
media |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
referrerPolicy |
58 | 79 | 50 | 45 | 14.1 | 58 | 50 | 43 | 14.5 | 7.0 | 58 | 14.5 |
rel |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
relList |
50 | 17 | 30 | 37 | 9 | 50 | 30 | 37 | 9 | 5.0 | 50 | 9 |
rev |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
sheet |
1 | 12 | 1 | 15 | 1 | 18 | 4 | 14 | 1 | 1.0 | 4.4 | 1 |
sizes |
15Before Chrome 50, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
79 | 31 | 15Before Opera 37, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
6 | 18Before Chrome Android 50, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
31 | 14Before Opera Android 37, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
6 | 1.0Before Samsung Internet 5.0, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
4.4Before WebView 50, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
6 |
target |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
type |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
<link>.
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement