The read-only baseURI
property of the Node
interface returns the absolute base URL of the document containing the node.
The base URL is used to resolve relative URLs when the browser needs to obtain an absolute URL, for example when processing the HTML <img>
element's src
attribute or the xlink:href
Deprecated or href
attributes in SVG.
Although this property is read-only, its value is determined by an algorithm each time the property is accessed, and may change if the conditions changed.
The base URL is determined as follows:
- By default, the base URL is the location of the document (as determined by
window.location
). - If it is an HTML Document and there is a
<base>
element in the document, thehref
value of the firstBase
element with such an attribute is used instead.