files/en-us/web/api/node/baseuri/index.md
{{APIRef("DOM")}}
The read-only baseURI property of the {{domxref("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 {{HTMLElement("img")}} element's src attribute or the xlink:href {{deprecated_inline}} 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:
href value of the first Base element with such an attribute is used instead.A string representing the base URL of the {{domxref("Node")}}.
<output>Not calculated</output>
const output = document.querySelector("output");
output.value = output.baseURI;
{{EmbedLiveSample("Without_base", "100%", 40)}}
<base href="https://developer.mozilla.org/modified_base_uri/" />
<output>Not calculated</output>
const output = document.querySelector("output");
output.value = output.baseURI;
{{EmbedLiveSample("With_base", "100%", 40)}}
{{Specifications}}
{{Compat}}