This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
The relList read-only property of the HTMLLinkElement interface reflects the rel attribute. It is a live DOMTokenList containing the set of link types indicating the relationship between the resource represented by the <link> element and the current document.
The property itself is read-only, meaning you can not substitute the DOMTokenList by another one, but the content of the returned list can be changed.
A live DOMTokenList of strings.
const links = document.getElementsByTagName("link");
for (const link of links) {
console.log("New link found.");
link.relList.forEach((relEntry) => {
console.log(relEntry);
});
}
| Specification |
|---|
| HTML> # dom-link-rellist> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
relList |
50 | 17 | 30 | 37 | 9 | 50 | 30 | 37 | 9 | 5.0 | 50 | 9 |
<a> and <area>, HTMLAnchorElement.relList and HTMLAreaElement.relList.HTMLLinkElement.rel
© 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/relList