Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM documentURI Property

  • Last Updated : 20 Jul, 2021

The documentURI property in HTML DOM used to set or return the location of a document. The return value is null If the document was created by the DocumentImplementation object or undefined
The documentURI property can be used on any document types.

Syntax: 
 

  • Return the documentURI property: 
     
document.documentURI
  • Set the documentURI property: 
     
document.documentURI = locationURI

Return Values: It returns a string value which represents the URL of the Document.

Example: Return the documentURI property: 
 

html




<!DOCTYPE html>
<html>
 
<body>
    <center>
        <h1 style="color:green">GeeksforGeeks</h1>
        <h2>HTML DOM documentURI Property</h2>
        <button onclick="GFGfun()">Click Me!</button>
 
        <p id="demo"></p>
 
    </center>
    <script>
        function GFGfun() {
            var v = document.documentURI;
            document.getElementById("demo").innerHTML = v;
        }
    </script>
 
</body>
 
</html>

Output: 
Before: 
 



After: 
 

Supported Browsers: The browsers supported by HTML DOM documentURI Property are listed below: 
 

  • Google Chrome
  • Firefox
  • Apple Safari
  • Opera

 

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :