Anchor hostname attribute

Definition and usage

hostname Attribute setting or returning href attribute value Hostname part.

See also:

JavaScript Reference Manual:location.hostname attribute

Example

Example 1

Return the link hostname:

var x = document.getElementById("myAnchor").hostname;

Try it yourself

Example 2

Change the link hostname:

document.getElementById("myAnchor").hostname = "www.somenewexamplepage.com";

Try it yourself

Example 3

Another example of how to change the link hostname:

document.getElementById("myAnchor").hostname = "www.codew3c.com";

Try it yourself

Syntax

Return hostname attribute:

anchorObject.hostname

set hostname attribute:

anchorObject.hostname = hostname

ਪ੍ਰਤੀਯੋਗਿਤਾ ਮੁੱਲ

ਮੁੱਲ ਵਰਣਨ
hostname ਸਪੁਰਦਗੀ ਦਾ ਯੂਆਰਐੱਲ ਦਾ ਮੁੱਖ ਨਾਮ ਸੁਝਾਏ ਹੈ。

ਤਕਨੀਕੀ ਵੇਰਵੇ

ਵਾਪਸੀ ਮੁੱਲ: ਪਾਠ ਮੁੱਲ, ਯੂਆਰਐੱਲ ਦੇ ਹੋਸਟਨੇਮ (ਜਾਂ IP ਅਡਰੈੱਸ) ਦੇ ਪ੍ਰਤੀਯੋਗਿਤਾ

ਬਰਾਉਜ਼ਰ ਸਮਰਥਨ

ਚਰਮ ਐਂਜਲ ਫਾਇਰਫਾਕਸ ਸੈਫਾਰੀ ਓਪੇਰਾ
ਚਰਮ ਐਂਜਲ ਫਾਇਰਫਾਕਸ ਸੈਫਾਰੀ ਓਪੇਰਾ
ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ