Javascript Reference - HTML DOM baseURI Property








The baseURI property returns the base URI of the HTML document.

Browser Support

baseURI Yes No Yes Yes Yes

Syntax

node.baseURI 

Return Value

A String representing the URI of the page.

Example

The following code shows how to get the baseURI of the document.


<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<!-- w  w w. j  a  va 2 s  .c o  m-->
<script>
function myFunction()
{
    var x=document.getElementById("demo");
    x.innerHTML=document.baseURI;
}
</script>

</body>
</html>

The code above is rendered as follows: