Document baseURI Property - Javascript DOM

Javascript examples for DOM:Document baseURI


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

This property is read-only.

Return Value

A String, representing the URI of the node's page

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {/*from   w w  w. j  a v  a 2  s  .  c  o  m*/
    var x = document.baseURI;
    document.getElementById("demo").innerHTML = x;


Related Tutorials