asp.net.ph

Skip Navigation Links

host Property

location Properties   DHTML Objects


Sets or retrieves the hostName and port number of the location or URL.

Syntax

HTML N/A
Script object.host [ = sHost ]

Possible Values

sHost String specifying the hostName and port number.

The property is read/write with no default value.

Remarks

The property is the concatenation of the hostName and port properties, separated by a colon ( hostName:port ). When the port property is null, the host property is the same as the hostName property.

The host property may be set at any time, although it is safer to set the href property to change a location. If the specified host cannot be found, an error is returned.

Example

The following example displays the location host property in a message box.

alert ( location.host ) 

 Show me 

Applies To

A, AREA, location


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note