HTMLAnchorElement.hostname
HTMLAnchorElement.hostname
プロパティは、URL のドメインを含む文字列です。
値
文字列です。
例
// <a id="myAnchor" href="/en-US/docs/HTMLAnchorElement"> 要素が文書内にあるとします
const anchor = document.getElementById("myAnchor");
anchor.hostname; // 'developer.mozilla.org' を返す
仕様書
Specification |
---|
HTML Standard # dom-hyperlink-hostname-dev |
ブラウザーの互換性
BCD tables only load in the browser
関連情報
- 所属先の
HTMLAnchorElement
インターフェイス