HTML DOM Link Object

Link Object

The Link object represents the HTML <link> element.

Access Link Object

You can use getElementById() to access the <link> element:

var x = document.getElementById("myLink");

Try It Yourself

Create Link Object

You can use the document.createElement() method to create a <link> element:

var x = document.createElement("LINK");

Try It Yourself

Link Object Properties

Properties Description
charset

Not supported in HTML5.

Set or return the character encoding of the linked document.

crossOrigin Set or return the CORS settings of the linked document.
disabled Set or return whether the linked document is disabled.
href Set or return the URL of the linked document.
hreflang Set or return the language code of the linked document.
media Set or return the media type of the linked element.
rel Set or return the relationship between the current document and the linked document.
rev

Not supported in HTML5.

Set or return the reverse relationship from the linked document to the current document.

sizes Return the sizes attribute value of the linked resource.
type Set or return the content type of the linked document.

Standard Properties and Events

The Link Object Supports Both StandardsPropertiesAndEvents.

Related Pages

HTML Reference Manual:HTML <link> Tag