HTMLAreaElement: host プロパティ - Web API | MDN

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

hostHTMLAreaElement インターフェイスのプロパティで、ホスト名、すなわち hostname が入った文字列で、 URL のポート番号が空でない場合は、 ":" に続いて URL のポート番号が続きます。この URL に hostname がない場合は、このプロパティには空文字列 ("") が入ります。

詳しくは URL.host を参照してください。

文字列です。

js

const area = document.createElement("area");

area.href = "https://developer.mozilla.org/ja/HTMLAreaElement";
area.host === "developer.mozilla.org";

area.href = "https://developer.mozilla.org:443/ja/HTMLAreaElement";
area.host === "developer.mozilla.org";
// ポート番号は、 443 がスキームの既定のポートであるため含まれない

area.href = "https://developer.mozilla.org:4097/ja/HTMLAreaElement";
area.host === "developer.mozilla.org:4097";

仕様書

Specification
HTML
# dom-hyperlink-host-dev

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.