PROPERTY:
Link::hostname
object.hostname
hostname is a property of both the Link
and the Location objects and specifies
the server name, subdomain and domain name (or IP address) of a URL.
Assuming a link (stored in the first element of the links property)
to a URL ...
http://home.newco.com/products/enquiries.htm#local?email=name@otherco.com
...the following code would display the hostname property of
it:
Code:
document.write(document.links[0].hostname)
Output:
home.newco.com
NOTE:
Although the hostname property can be set at any time, it is
safer to set the href property to change
a link.
|