Return the base URL for all relative URLs on a page:
The result of x will be:
The href property sets or returns the value of the href attribute in a base element.
The href attribute specifies a base URL for all relative URLs on a page.
By default, the base URL is the location of the current document, but it can be overridden by this property.
The href property is supported in all major browsers.
Return the href property:
Set the href property:
Value | Description |
---|---|
URL | Specifies the base URL |
Return Value: | A String, representing the base URL for all relative URLS on a page, including the protocol (like http://) |
---|
Change the value of the base URL:
HTML reference: HTML <base> href attribute