HTMLAreaElement.hostname

The HTMLAreaElement.hostname property is a USVString containing the domain of the URL.

Syntax

// Getter
string = area.hostname;
// Setter
area.hostname = string;

Examples

// An <area id="myArea" href="/en-US/docs/HTMLAreaElement"> element is in the document
const area = document.getElementById("myArea");
HTMLAreaElement.hostname; // returns 'developer.mozilla.org'

Specifications

Browser compatibility

BCD tables only load in the browser

See also