Base href attribute

Definition and usage

href Sets or returns the value of the href attribute of the base element.

Base href attribute Specify the base URL for all relative URLs on the page.

By default, the base URL is the location of the current document, but it can be overridden by this attribute.

See also:

HTML ਸੰਦਰਭ ਮੈਨੂਅਲ:HTML <base> ਟੈਗ

Example

Example 1

Return the base URL of all relative URLs on the page:

var x = document.getElementById("myBase").href;

Try it yourself

Example 2

Change the value of the base URL:

document.getElementById("myBase").href = "https://www.codew3c.com/html/";

Try it yourself

Syntax

Return href attribute:

baseObject.href

set href attribute:

baseObject.href = URL

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

ਮੁੱਲ ਵਰਣਨ
URL ਅਧਾਰ ਯੂਆਰਐੱਲ ਨੂੰ ਨਿਰਧਾਰਿਤ ਕਰੋ。

ਤਕਨੀਕੀ ਵੇਰਵੇ

ਵਾਪਸੀ ਮੁੱਲ: ਪਾਠ ਕੀਤੀ ਗਈ ਵਾਲੀ ਮਾਤਰਾ, ਪੰਨੇ 'ਤੇ ਸਾਰੇ ਸਬੰਧਤ ਯੂਆਰਐੱਲ ਦੇ ਅਧਾਰ ਯੂਆਰਐੱਲ ਨੂੰ ਪ੍ਰਤੀਯੋਗ ਕਰਦੀ ਹੈ, ਜਿਵੇਂ ਕਿ ਪ੍ਰੋਟੋਕੋਲ (ਜਿਵੇਂ ਕਿ http://)。

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

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

ਸਬੰਧਤ ਪੰਨੇ

HTML ਸੰਦਰਭ ਮੈਨੂਅਲ:HTML <base> href ਪ੍ਰਤੀਯੋਗ