{{DOMRef}}
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 {{domxref("HTMLElement")}} interface.
Properties
Inherits properties from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.
-
HTMLLinkElement.charset
{{obsolete_inline}} - Gets or sets the character encoding for the target resource.
-
{{experimental_inline}}HTMLLinkElement.
crossOrigin - A {{domxref("DOMString")}} that corresponds to the CORS setting for this link element. See CORS settings attributes for details.
-
HTMLLinkElement.
disabled - Gets or sets whether the link is disabled; currently only used with style sheet links.
-
HTMLLinkElement.
href - Gets or sets the URI for the target resource.
-
HTMLLinkElement.
hreflang - Gets or sets the language code for the linked resource.
-
HTMLLinkElement.
media - Gets or sets a list of one or more media formats to which the resource applies.
-
HTMLLinkElement.
rel - Gets or sets the forward relationship of the linked resource from the document to the resource.
-
{{readonlyInline}}HTMLLinkElement.
relList - Is a {{domxref("DOMTokenList")}} that reflects the {{htmlattrxref("rel", "link")}} HTML attribute, as a list of tokens.
-
{{obsolete_inline}}HTMLLinkElement.
rev - Gets or sets the reverse relationship of the linked resource from the resource to the document.
-
{{readonlyInline}}HTMLLinkElement.
sizes - Is a {{domxref("DOMSettableTokenList")}} that reflects the {{htmlattrxref("sizes", "link")}} HTML attribute, as a list of tokens.
-
LinkStyle.sheet
{{readonlyInline}} -
Returns the {{domxref("StyleSheet")}} object associated with the given element, or
null
if there is none. -
{{obsolete_inline}}HTMLLinkElement.
target - Gets or sets the name of the target frame to which the resource applies.
-
HTMLLinkElement.
type - Gets or sets the MIME type of the linked resource.
Methods
No specific method; inherits methods from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', "semantics.html#the-link-element", "HTMLLinkElement")}} | {{Spec2('HTML WHATWG')}} | The following property has been added: crossOrigin . |
{{SpecName('HTML5 W3C', "document-metadata.html#the-link-element", "HTMLLinkElement")}} | {{Spec2('HTML5 W3C')}} | The following properties are now obsolete: charset , rev , and shape .The following properties have been added: relList , and sizes . |
{{SpecName('DOM2 HTML', 'html.html#ID-35143001', 'HTMLLinkElement')}} | {{Spec2('DOM2 HTML')}} | Added a second inheritence, the {{domxref("LinkStyle")}} interface. |
{{SpecName('DOM1', 'level-one-html.html#ID-35143001', 'HTMLLinkElement')}} | {{Spec2('DOM1')}} | Initial definition. |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoDesktop(1.0)}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
sizes |
{{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
crossOrigin {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoDesktop(18)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoMobile(1.0)}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
sizes |
{{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
crossOrigin {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoMobile(18)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
See also
- The HTML element implementing this interface: {{HTMLElement("link")}}.