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
locationproperty to obtain the URL of the currently displayed document and to load new documents.Browsing History covers the
historyproperty, and shows how to move the browser backward and forward through its history.Browser and Screen Information shows how to use the
navigatorproperty to obtain browser vendor and version information and how to use thescreenproperty 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
onerrorhandler 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access