The documentURI
property sets or gets the location of a document.
documentURI |
Yes | No | Yes | Yes | Yes |
Set the documentURI:
document.documentURI=locationURI
Return the documentURI:
var v = document.documentURI
A String type value representing the URI of the document.
The following code shows how to get the location URI of the document.
<!DOCTYPE html>
<html>
<body>
<p id="demo">test</p>
<button onclick="myFunction()">test</button>
<!-- w ww .ja va 2 s . c om-->
<script>
function myFunction()
{
var x=document.getElementById("demo");
x.innerHTML=document.documentURI;
}
</script>
</body>
</html>
The code above is rendered as follows: