HTMLLinkElement
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.
Properties
Inherits properties from its parent, HTMLElement
.
HTMLLinkElement.as
-
Is a
DOMString
representing the type of content being loaded by the HTML link. -
HTMLLinkElement.crossOrigin
-
Is a
DOMString
that corresponds to the CORS setting for this link element. See CORS settings attributes for details. HTMLLinkElement.disabled
-
Is a
Boolean
which represents whether the link is disabled; currently only used with style sheet links. HTMLLinkElement.href
-
Is a
DOMString
representing the URI for the target resource. HTMLLinkElement.hreflang
-
Is a
DOMString
representing the language code for the linked resource. HTMLLinkElement.media
-
Is a
DOMString
representing a list of one or more media formats to which the resource applies. -
HTMLLinkElement.referrerPolicy
-
Is a
DOMString
that reflects thereferrerpolicy
HTML attribute indicating which referrer to use. HTMLLinkElement.rel
-
Is a
DOMString
representing the forward relationship of the linked resource from the document to the resource. -
HTMLLinkElement.relList
Read only -
Is a
DOMTokenList
that reflects therel
HTML attribute, as a list of tokens. -
HTMLLinkElement.sizes
Read only -
Is a
DOMSettableTokenList
that reflects thesizes
HTML attribute, as a list of tokens. -
HTMLLinkElement.sheet
Read only -
Returns the
StyleSheet
object associated with the given element, ornull
if there is none. HTMLLinkElement.type
-
Is a
DOMString
representing the MIME type of the linked resource.
Obsolete properties
-
HTMLLinkElement.charset
-
Is a
DOMString
representing the character encoding for the target resource. -
HTMLLinkElement.rev
-
Is a
DOMString
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
-
Is a
DOMString
representing the name of the target frame to which the resource applies.
Methods
No specific method; inherits methods from its parent, HTMLElement
.
Specifications
Specification |
---|
HTML Standard (HTML) # htmllinkelement |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
HTMLLinkElement |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
as |
50 |
17 |
56 |
No |
37 |
10 |
50 |
50 |
56 |
37 |
10 |
5.0 |
charset |
1 |
12 |
1 |
6 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
crossOrigin |
34 |
17 |
18 |
No |
21 |
10 |
37 |
34 |
18 |
21 |
10 |
2.0 |
disabled |
1
In Chrome and other Blink-based browsers, adding the
disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets . |
12
Since Edge 79, adding the
disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets . |
1 |
5.5 |
≤12.1
In Chrome and other Blink-based browsers, adding the
disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets . |
3 |
1
In Chrome and other Blink-based browsers, adding the
disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets . |
18
In Chrome and other Blink-based browsers, adding the
disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets . |
4 |
≤12.1
In Chrome and other Blink-based browsers, adding the
disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets . |
1 |
1.0
In Chrome and other Blink-based browsers, adding the
disabled attribute using JavaScript does not remove the stylesheet from document.styleSheets . |
href |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
hreflang |
1 |
12 |
1 |
6 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
imageSizes |
73 |
79 |
78 |
No |
60 |
No |
73 |
73 |
79 |
52 |
No |
11.0 |
imageSrcset |
73 |
79 |
78 |
No |
60 |
No |
73 |
73 |
79 |
52 |
No |
11.0 |
integrity |
45 |
17 |
43 |
No |
32 |
11.1 |
45 |
45 |
43 |
32 |
11.3 |
5.0 |
media |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
referrerPolicy |
58 |
79 |
50 |
No |
45 |
14.1 |
58 |
58 |
50 |
43 |
14.5 |
7.0 |
rel |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
relList |
50 |
17 |
30 |
No |
37 |
9 |
50 |
50 |
30 |
37 |
9 |
5.0 |
rev |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
sizes |
15
Before Chrome 50, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
79 |
31 |
No |
15
Before Opera 37, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
6 |
≤37
Before WebView 50, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
18
Before Chrome 50, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
31 |
14
Before Opera 37, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
6 |
1.0
Before Samsung Internet 5.0, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
target |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
type |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
sheet |
1 |
12 |
1 |
9 |
15 |
1 |
1 |
18 |
4 |
14 |
1 |
1.0 |
See also
- The HTML element implementing this interface:
<link>
.
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement