Web server - 385Chapter 16Window and Frame ObjectslocationValue:Object.Read/WriteCompatibility:WinIE3+, MacIE3+, NN2+, Moz1+,

385Chapter 16Window and Frame ObjectslocationValue:Object.Read/WriteCompatibility:WinIE3+, MacIE3+, NN2+, Moz1+, Safari1+ (See the discussion of the locationobject in Chapter 17.) locationbar(See directories) nameValue:String.Read/WriteCompatibility:WinIE3+, MacIE3+, NN2+, Moz1+, Safari1+ All windowobjects can have names assigned to them. Names are particularly useful for work- ing with frames, because a good naming scheme for a multiframe environment can help youdetermine precisely which frame you re working with in references coming from other frames. The main browser window, however, has no name attached to it by default. Its value is anempty string. There aren t many reasons to assign a name to the window, because JavaScriptand HTML provide plenty of other ways to refer to the windowobject (the topproperty, the_topconstant for targetattributes, and the openerproperty from subwindows). If you want to attach a name to the main window, you can do so by setting the window.nameproperty at any time. But be aware that because this is one window property whose lifeextends beyond the loading and unloading of any given document, chances are that yourscripts would use the reference in only one document or frameset. Unless you restore thedefault empty string, your programmed window name will be present for any other documentthat loads later. My suggestion in this regard is to assign a name in a window s or frameset sonloadevent handler, and then reset it to empty in a corresponding onunloadevent handler: You can see an example of this application in Listing 16-16, where setting a parent windowname is helpful for learning the relationships among parent and child windows. Related Items:topproperty; window.open(), window.sizeToContent()methods. navigatorValue:Object.Read-OnlyCompatibility:WinIE4+, MacIE4+, NN6+, Moz1+, Safari1+ Although the navigatorobject appears as a property of the windowobject only in the mostrecent browsers, the navigatorobject has been around since the very beginning (seeChapter 38 on the CD-ROM). In previous browsers, the navigatorobject was referenced as astandalone object. And because you can omit any reference to the windowobject for a win- dowobject s properties, you can use the same window-less reference syntax for compatibilityacross all scriptable browsers (at least for the navigatorobject properties that exist acrossall browsers). That s the way I recommend referring to the navigatorobject. ExampleThis book is littered with examples of using the navigatorobject, primarily for performingbrowser detection. You can find examples of specific navigatorobject properties in Chapter38 on the CD-ROM. Related Items:navigatorobject. windowObject.navigator

Leave a Reply