Chapter 4
Programming the Browser Window
In this chapter, you'll learn how to program the browser window, the top-level object in the Dynamic HTML object model. Through the window object, information about the browser and the contained document can be accessed. Two types of HTML documents can be displayed inside a window: a frameset document and a standard HTML document. Frameset documents partition a single window into multiple, independently accessible frames. Chapter 5, "Window and Frame Management" and Chapter 6, "Programming the HTML Document," discuss the two types of documents in detail.
The window object exposes document information (including information about the frames on the page and the URL to the current document) and provides access to information about the browser itself (including the client brand, version, and features supported, through a shared navigator object), access to event information, and most importantly, access to the document object that exposes the HTML document itself. The window object also lets you move forward and backward through the history, customize the browser's appearance, and move and relocate the window.
This chapter and Chapter 5 teach you how to manipulate the browser and the contained document using the window object. This chapter focuses on the members for manipulating the current window; Chapter 5 continues the discussion by showing you how to manipulate framesets and multiple browser instances. The document object is discussed in Chapter 6, and most of the following chapters focus on how to use the document object to create interactive documents.
The following topics are covered in this chapter:
- The window object
This section provides a brief introduction to the window object and its relationship to other objects, including its unique relationship to global variables, which act as public members of the window object.
- Window environment
This section shows you how to manipulate the browser environment-including the browser's status bar, ,the location of the document,,the history list, and the user's screen resolution.
- Window events
The window object exposes changes in the document's state through several events. For example, these events can help you determine when the document has finished loading and whether the document is currently active.
- Timer Events
The window object also exposes methods for creating timers. Timers are events that execute code after a specified amount of time.
- client and navigator properties
The navigator object exposes specific information about the client. This information includes the brand, version, and user options, allowing scripts to determine the capabilities of the client and to adjust the page accordingly.