Chapter 14. The Window Object
Chapter 13 introduced the Window object and the central role it plays in client-side JavaScript: it is the global object for client-side JavaScript programs. This chapter covers the properties and methods of the Window object. These properties define a number of different APIs, only some of which are actually related to the browser windows for which the Window object was named. This chapter covers the following:
Timers shows how to use
setTimeout()
andsetInterval()
to register a function to be invoked at specified times in the future.Browser Location and Navigation explains how to use the
location
property to obtain the URL of the currently displayed document and to load new documents.Browsing History covers the
history
property, and shows how to move the browser backward and forward through its history.Browser and Screen Information shows how to use the
navigator
property to obtain browser vendor and version information and how to use thescreen
property to query the size of the desktop.Dialog Boxes shows how to display simple text dialogs with the
alert()
,confirm()
, andprompt()
methods and how to display HTML dialog boxes withshowModalDialog()
.Error Handling explains how you can register an
onerror
handler method to be invoked when uncaught JavaScript exceptions occur.Document Elements As Window Properties explains that the IDs and names of HTML elements are used as properties of the Window object.
Multiple Windows and Frames is a long section that ...
Get JavaScript: The Definitive Guide, 6th Edition 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.