HTMLLinkElement
Baseline Widely available *
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.
TheHTMLLinkElement 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 byHTMLAnchorElement). This object inherits all of the properties and methods of theHTMLElement interface.
In this article
Instance properties
Inherits properties from its parent,HTMLElement.
HTMLLinkElement.asA string representing the type of content being loaded by the HTML link when
rel="preload"orrel="modulepreload".HTMLLinkElement.blockingA string indicating that certain operations should be blocked on the fetching of an external resource. It reflects the
blockingattribute of the<link>element.HTMLLinkElement.crossOriginA string that corresponds to the CORS setting for this link element. SeeCORS 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:
highto fetch at a higher priority,lowto fetch at a lower priority, orautoto 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
imagesizesHTML attribute; a list of comma-separated image conditions and sizes.HTMLLinkElement.imageSrcsetA string reflecting the
imagesrcsetHTML 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
integrityattribute of the<link>element.HTMLLinkElement.mediaA string representing a list of one or more media formats to which the resource applies. It reflects the
mediaattribute of the<link>element.HTMLLinkElement.referrerPolicyA string that reflects the
referrerpolicyHTML attribute indicating which referrer to use.HTMLLinkElement.relA string representing the forward relationship of the linked resource from the document to the resource.
HTMLLinkElement.relListRead onlyA
DOMTokenListthat reflects therelHTML attribute, as a list of tokens.HTMLLinkElement.sizesRead onlyA
DOMTokenListthat reflects thesizesHTML attribute, as a list of tokens.HTMLLinkElement.sheetRead onlyReturns the
StyleSheetobject associated with the given element, ornullif there is none.HTMLLinkElement.typeA string representing the MIME type of the linked resource.
Obsolete properties
HTMLLinkElement.charsetDeprecatedA string representing the character encoding for the target resource.
HTMLLinkElement.revDeprecatedA 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
revis 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.targetDeprecatedA string representing the name of the target frame to which the resource applies.
Instance methods
No specific method; inherits methods from its parent,HTMLElement.
Specifications
| Specification |
|---|
| HTML> # htmllinkelement> |
Browser compatibility
See also
- The HTML element implementing this interface:
<link>.