アンカーrelプロパティ
例
リンクのrel属性の値を返します。
var x = document.getElementById("myAnchor").rel;
定義と使用法
relプロパティは、リンクのrel属性の値を設定または返します。
rel属性は、現在のドキュメントとリンクされたドキュメントの間の関係を指定します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
rel | Yes | Yes | Yes | Yes | Yes |
構文
relプロパティを返します。
anchorObject.rel
relプロパティを設定します。
anchorObject.rel = "value"
プロパティ値
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 |
技術的な詳細
戻り値: | 現在のドキュメントとリンクされたドキュメントの間の関係を表す文字列 |
---|
その他の例
例
rel属性の値を「nofollow」に設定します。
document.getElementById("myAnchor").rel = "nofollow";
関連ページ
HTMLリファレンス:HTML <a> rel属性
❮アンカーオブジェクト