Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Base href attribute

Base href attribute

Base Object Reference 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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 Reference Base Object