Objet de lien HTML DOM
Objet de lien
L'objet Link représente un élément HTML <link>.
Accéder à un objet lien
Vous pouvez accéder à un élément <link> en utilisant getElementById() :
Exemple
var x = document.getElementById("myLink");
Créer un objet lien
Vous pouvez créer un élément <link> en utilisant la méthode document.createElement() :
Exemple
var x = document.createElement("LINK");
Propriétés de l'objet de lien
Property | Description |
---|---|
charset | Not supported in HTML5. Sets or returns the character encoding of the linked document |
crossOrigin | Sets or returns the the CORS settings of the linked document |
disabled | Sets or returns whether the linked document is disabled, or not |
href | Sets or returns the URL of the linked document |
hreflang | Sets or returns the language code of the linked document |
media | Sets or returns the media type for the link element |
rel | Sets or returns the relationship between the current document and the linked document |
rev | Not supported in HTML5. Sets or returns the reverse relationship from the linked document to the current document |
sizes | Returns the value of the sizes attribute of the linked resource |
type | Sets or returns the content type of the linked document |
Propriétés et événements standard
L'objet Link prend également en charge les propriétés et événements standard .
Pages connexes
Référence HTML : balise HTML <link>