HTMLLinkElement
The HTMLLinkElement interface represents reference information for external resources and the relationship of those resources to a document and vice-versa. This object inherits all of the properties and methods of the HTMLElement interface.
Properties
Inherits properties from its parent, HTMLElement, and LinkStyle (en-US).
HTMLLinkElement.as(en-US)-
Is a
DOMStringrepresenting the type of content being loaded by the HTML link. HTMLLinkElement.crossOrigin实验性-
Is a
DOMStringthat corresponds to the CORS setting for this link element. See CORS settings attributes (en-US) for details. HTMLLinkElement.disabled-
Is a
Booleanwhich represents whether the link is disabled; currently only used with style sheet links. HTMLLinkElement.href-
Is a
DOMStringrepresenting the URI for the target resource. HTMLLinkElement.hreflang-
Is a
DOMStringrepresenting the language code for the linked resource. HTMLLinkElement.media-
Is a
DOMStringrepresenting a list of one or more media formats to which the resource applies. HTMLLinkElement.referrerPolicy实验性-
Is a
DOMStringthat reflects thereferrerpolicyHTML attribute indicating which referrer to use. HTMLLinkElement.rel(en-US)-
Is a
DOMStringrepresenting the forward relationship of the linked resource from the document to the resource. HTMLLinkElement.relList(en-US) 只读-
Is a
DOMTokenListthat reflects therelHTML attribute, as a list of tokens. HTMLLinkElement.sizes只读-
Is a
DOMSettableTokenListthat reflects thesizesHTML attribute, as a list of tokens. LinkStyle.sheet(en-US) 只读-
Returns the
StyleSheetobject associated with the given element, ornullif there is none. HTMLLinkElement.type-
Is a
DOMStringrepresenting the MIME type of the linked resource.
Obsolete properties
HTMLLinkElement.charset已弃用-
Is a
DOMStringrepresenting the character encoding for the target resource. HTMLLinkElement.rev已弃用-
Is a
DOMStringrepresenting the reverse relationship of the linked resource from the resource to the document.备注: 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.target已弃用-
Is a
DOMStringrepresenting the name of the target frame to which the resource applies.
Methods
No specific method; inherits methods from its parent, HTMLElement, and LinkStyle (en-US).
Specifications
| Specification |
|---|
| HTML Standard # htmllinkelement |
Browser compatibility
BCD tables only load in the browser
See also
- The HTML element implementing this interface:
<link>.