Skip to main content
property URL.hostname

The hostname property of the URL interface is a string that represents the fully qualified domain name of the URL.

Examples

Example 1

const myURL = new URL('https://foo.example.org/bar');
console.log(myURL.hostname);  // Logs "foo.example.org"

Type

string

See

Back to top