Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Location host Property

Location host Property

Location Object Reference Location object


Definition and Usage

The host property is a readable and writable string that sets or returns the hostname and port number of the current URL.

Syntax

location.host


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the host property.


Example

Example

Return the hostname and port of the current URL:

Output result of the above example:

Try it »


Location Object Reference Location object