Netscape supports a constructor property for the Navigator object. You won't find very many circumstances where you will need to create a new instance of the Navigator object.
This is another example of where the generic approach to creating objects that Netscape employs may be less optimal than the special individually coded objects support that MSIE employs (even though it leads to a more bulky implementation).
Because Netscape supplies a constructor for virtually every object type that it supports, there is a constructor for the Navigator object class. However, trying to access the navigator.constructor value is quite hard. There seems to be a bug in its implementation that prevents it being converted to a primitive. However it still responds to a request for its name or prototype properties.
Since this object behaves in this strange way, building general-purpose scripts that access constructors is quite hard. During our research, several general purpose inspector scripts were written. One that examined constructors worked on most objects but failed on the Navigator object.
This may be a scope-chain problem, because if you pass a Navigator object to a function in one of its arguments, then accessing the constructor of that argument may yield the source text of the function. This problem is manifested in Netscape 4.7 for Macintosh and may be extant on other platforms.
This doesn't seem to affect whether the other properties that the Navigator object supports can be enumerated in a for( ... in ... ) loop.
Prev | Home | Next |
Navigator.browserLanguage | Up | Navigator.cookieEnabled |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |