9.2 window Object

In the previous chapter, you learned about the document object model (DOM), which uses the document object as the root node of the DOM’s node tree. The node tree contains objects for each entity within a web page—elements, attributes, and plain text. You can use JavaScript with the DOM’s objects to manipulate the elements, attributes, and plain text in a web page. Usually, as a JavaScript programmer, all you’ll need to access are the things within the current web page. But sometimes there’s a need to access the window that contains the web page. To do that, you can use the window object.

When you launch a browser (e.g., when you double click the Chrome icon on your desktop), or you launch a new tab within a browser window, ...

Get Web Programming with HTML5, CSS, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.