O'Reilly logo

JavaScript® Bible, Seventh Edition by Paul Novitski, Danny Goodman, Tia Gustaff Rayl, Michael Morrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 42. The Navigator and Other Environment Objects

IN THIS CHAPTER

  • Determining which browser the user has

  • Branching scripts according to the user's operating system

  • Detecting plug-in support

Client-side scripting primarily focuses on the document inside a browser window and the content of the document. As discussed in Chapter 27, "Window and Frame Objects," the window, too, is an important part of how you apply JavaScript on the client. Stepping out one more level, we get to the browser application itself. Scripts sometimes need to know about the browser and the computing environment in which it runs so that they can tailor dynamic content for the current browser and operating system.

To that end, browsers provide objects that expose as much about the client computer and browser as is feasible within accepted principles of preserving a user's privacy. In addition to providing some of the same information that server-side programs receive as environment variables, these browser-level objects may also include information about how well equipped the browser is with regard to plug-ins and Java. Another object reveals information about the user's video monitor, which may influence the way your scripts calculate information displayed on the page.

The objects in this chapter don't show up on the document object hierarchy diagrams, except as free-standing groups. The IE4+ object model, however, incorporates these environmental objects as properties of the window object. Because the window ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required