15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Navigator<br />

and Other<br />

Environment<br />

Objects<br />

(Chapter 28)<br />

Objects covered in this chapter are somewhat distant<br />

from the document and its content, but they are no less<br />

important to scripters. Any script branching that relies on<br />

knowing details about the browser version or other aspects<br />

of the environment running the browser calls upon the<br />

navigator object. Properties of the navigator object (also<br />

named the clientInformation object in IE4+), reveal<br />

browser brand and version information, as well as operating<br />

system and, in some cases, encryption powers of the browser.<br />

Using signed scripts with NN4+, you can even script modification<br />

to browser preferences.<br />

Avoid using navigator object properties for browser<br />

version branching when more sophisticated techniques —<br />

notably object detection as described in Chapter 14 of the<br />

<strong>JavaScript</strong> <strong>Bible</strong> — are less dependent upon future quirks in<br />

object model developments. But version detection is perfect<br />

when you know that a special workaround is needed for some<br />

glitch in a specific version or class of browser. For example,<br />

NN4/Windows can exhibit some strange behavior when<br />

attempting to print a page whose content relies on script<br />

execution. Provided you have a code workaround for the<br />

problem, you can divert script execution for just that version<br />

of NN in just the Windows version.<br />

<strong>Examples</strong> in this chapter also touch upon the screen<br />

object and the IE/Windows userProfile object. The screen<br />

object is useful in determining the size of a new window, but<br />

there is little need to script the userProfile object.<br />

12<br />

C H A P T E R<br />

✦ ✦ ✦ ✦<br />

In This Chapter<br />

Determining the<br />

user’s browser,<br />

operating system,<br />

and video monitor<br />

settings<br />

Modifying NN4+<br />

browser preferences<br />

Retrieving IE4+ user<br />

profile information<br />

✦ ✦ ✦ ✦

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!