Base href attribute
Base Object
Definition and Usage
The href attribute sets or returns the base URL for all links in the page.
Syntax
baseObject.href=
URL
Browser support





All major browsers support the href property.
Example
Example
The following example returns the base URL of the page:
Base URL is:
The example above produces the following output:
Base URL is: https://www.runoob.com/jsref/
Try it »
Base Object