Document documentURI Property - Javascript DOM

Javascript examples for DOM:Document documentURI

Description

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>
<html>
<body>

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

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

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

</body>
</html>

Related Tutorials