--- title: HTMLHyperlinkElementUtils.hostname slug: Web/API/HTMLAnchorElement/hostname tags: - API - Experimental - HTMLHyperlinkElementUtils - Property - Reference - URL API translation_of: Web/API/HTMLHyperlinkElementUtils/hostname original_slug: Web/API/HTMLHyperlinkElementUtils/hostname ---
{{ApiRef("URL API")}}
HTMLHyperlinkElementUtils.hostname プロパティは、URL のドメインを含む {{domxref("USVString")}} です。
string = object.hostname; object.hostname = string;
// <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.hostname"> 要素がドキュメントにあるとします
var anchor = document.getElementByID("myAnchor");
var result = anchor.hostname; // 戻り値: 'developer.mozilla.org'
| 仕様 | 状態 | コメント |
|---|---|---|
| {{SpecName('HTML WHATWG', '#dom-hyperlink-hostname', 'HTMLHyperlinkElementUtils.hostname')}} | {{Spec2('HTML WHATWG')}} | 初期定義 |
{{Compat("api.HTMLHyperlinkElementUtils.hostname")}}