The baseURI
property returns the base URI of the HTML document.
baseURI |
Yes | No | Yes | Yes | Yes |
node.baseURI
A String representing the URI of the page.
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: