Document documentURI Property - Javascript DOM

Javascript examples for DOM:Document documentURI


The documentURI property sets or gets the location of a document.

documentURI property can be used on any document types, whereas URL can only be used on HTML documents.

Set the documentURI property:

Return Value

A String, representing the URI of the document

The following code shows how to get the location URI of the document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">display the location of this document</button>

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

function myFunction() {//from  w w w  .jav a  2  s. c om
    var x = document.documentURI;
    document.getElementById("demo").innerHTML = x;


Related Tutorials