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:
A String, representing the URI of the document
The following code shows how to get the location URI of the document:
<!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>