Ancre rel Propriété
Exemple
Renvoie la valeur de l'attribut rel d'un lien :
var x = document.getElementById("myAnchor").rel;
Définition et utilisation
La propriété rel définit ou renvoie la valeur de l'attribut rel d'un lien.
L'attribut rel spécifie la relation entre le document courant et le document lié.
Prise en charge du navigateur
Property | |||||
---|---|---|---|---|---|
rel | Yes | Yes | Yes | Yes | Yes |
Syntaxe
Renvoie la propriété rel :
anchorObject.rel
Définissez la propriété rel :
anchorObject.rel = "value"
Valeurs de propriété
Value | Description |
---|---|
alternate | An alternate version of the document (i.e. print page, translated or mirror) |
author | The author of the document |
bookmark | A related document |
help | A help document |
licence | Copyright information for the document |
next | The next document in a selection |
nofollow | "nofollow" is used by Google, to specify that the Google search spider should not follow that link (mostly used for paid links) |
noreferrer | Specifies that the browser should not send a HTTP referer header if the user follows the hyperlink |
prefetch | Specifies that the target document should be cached |
prev | The previous document in a selection |
search | A search tool for the document |
tag | A tag (keyword) for the current document |
Détails techniques
Valeur de retour : | Une chaîne, représentant la relation entre le document actuel et le document lié |
---|
Plus d'exemples
Exemple
Définissez la valeur de l'attribut rel sur "nofollow":
document.getElementById("myAnchor").rel = "nofollow";
Pages connexes
Référence HTML : attribut HTML <a> rel
❮ Objet d'ancrage