HTMLBaseElement <base>

The base URI for a page is provided in the HTMLBaseElement interface. All of the methods and attributes listed in the HTMLElement interface are inherited by this object. The base URL and/or target for each relative URL in a document are specified by the <base> tag. Either a target attribute or a href attribute, or both, must be included in the <base> tag. A document may have only one <base> element, and that element must be located inside the <head> element.

Attribute Value Description Example
href URL Specifies the base URL for all relative URLs in the page <head> <base href=""> </head>
target _blank Specifies the default target for all hyperlinks and forms in the page <head> <base target="_blank"> </head>

Browser Compatibility

Element Chrome Edge Firefox Safari Opera
<base> Yes Yes Yes Yes Yes