The Wayback Machine - https://web.archive.org/web/20230512160513/https://www.geeksforgeeks.org/html-dom-window-document-property/
Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

HTML DOM window document Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The HTML DOM window document returns a reference to the document contained in the current window.

Syntax:

doc = window.document;

Return Value: This property returns a reference to the document.

Example: In this example, we will get the title of the document using that document reference.

html




<title>Window document property</title>
  
<body style="text-align:center;">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <p>
        HTML | window document property
    </p>
    <button onclick="Geeks()">
        Click Here
    </button>
    <p id="a">
    </p>
    <script>
        var a = document.getElementById("a");
        function Geeks() {
            console.log(window.document)
            a.innerHTML=window.document.title;
        }
    </script>
</body>

Output:

Image

 

We have a complete list of HTML DOM methods, to check those please go through this HTML DOM Object Complete reference article.

Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Safari 1
  • Opera 12.1
  • Internet Explorer 4

We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript.

My Personal Notes arrow_drop_up
Last Updated : 05 Dec, 2022
Like Article
Save Article
Related Tutorials