HTMLAnchorElement: host プロパティ

HTMLAnchorElement.host プロパティは、ホストを含む文字列です。すなわち、ホスト名の後に、 URL のポートが空でない場合は、':'、および URL のポートが続きます。

文字列です。

js
const anchor = document.createElement("a");

anchor.href = "https://developer.mozilla.org/en-US/HTMLAnchorElement";
anchor.host === "developer.mozilla.org";

anchor.href = "https://developer.mozilla.org:443/en-US/HTMLAnchorElement";
anchor.host === "developer.mozilla.org";
// The port number is not included because 443 is the scheme's default port

anchor.href = "https://developer.mozilla.org:4097/en-US/HTMLAnchorElement";
anchor.host === "developer.mozilla.org:4097";

仕様書

Specification
HTML Standard
# dom-hyperlink-host-dev

ブラウザーの互換性

BCD tables only load in the browser

関連情報