The navigator Object s Properties


The navigator Object's Properties

You'll find the navigator object's properties in overview in Table 10.2, and in depth in Table 10.3.

Table 10.2. Overview of the Properties of the navigator Object

Properties

   

appCodeName

appMinorVersion

appName

appVersion

browserLanguage

cookieEnabled

cpuClass

language

mimeTypes

onLine

oscpu

platform

plugins

product

productSub

securityPolicy

systemLanguage

userAgent

userLanguage

userProfile

vendor

vendorSub

   
Table 10.3. The Properties of the navigator Object

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

appCodeName

x

x

x

x

x

x

x

x

x

x

 

Read-only

 

This property holds a string that is supposed to hold the browser's name. However, it's less useful than you might thinkboth the Internet Explorer and Netscape Navigator return "Mozilla" here, the former nickname for the Netscape Navigator and currently the name of its development browser.

appMinorVersion

           

x

x

x

x

 

Read-only

 

Retrieves the application's minor version value. (For example, in the value 6.2, 2 is the minor version.) Unfortunately, this property is not useful, because it returns the minor version of the appVersion property, which does not hold the true browser version. For example, Internet Explorer 5.5 reports version 4.0 in appVersion , which makes the appMinorVersion 0, not 5. Use the userAgent property instead to find this information.

appName

x

x

x

x

x

x

x

x

x

x

 

Read-only

 

Holds the browser's name, returns "Netscape" or "Microsoft Internet Explorer". See "Detecting Browser and Version" in this chapter.

appVersion

x

x

x

x

x

x

x

x

x

x

 

Read-only

 

Supposed to return the browser's version, but in fact returns the "Mozilla-compatibility" version. For example, Internet Explorer considers itself compatible with Mozilla (the former nickname for the Netscape Navigator and currently the name of its development browser) 4.0, and so reports 4.0 here (actually returns a string such as "4.0 (compatible; MSIE 6.0; Windows NT 5.0; COM+ 1.0.2204)" ). It's better to use the userAgent property. See "Detecting Browser and Version" in this chapter.

browserLanguage

           

x

x

x

x

 

Read-only

 

Holds the language the browser uses as its default. See "Using the browserLanguage , systemLanguage , and userLanguage Properties" in this chapter.

cookieEnabled

     

x

   

x

x

x

x

 

Read-only

 

Returns true if cookies are enabled in the browser, false otherwise .

cpuClass

           

x

x

x

x

 

Read-only

 

This Internet Explorer-only property holds a string that specifies the type of CPU on which the browser is running. Holds one of the following values "x86" for an Intel processor, "68K" for a Motorola processor, "Alpha" for a Digital processor, "PPC" for a Motorola-based Power PC, processor, and "Other" for other CPU classes (including such CPUs as Sun SPARC).

language

   

x

x

           
 

Read-only

 

Holds the language the browser was written for. Applicable only to Netscape Navigator 4+.

mimeTypes

 

x

x

x

           
 

Read-only

 

Holds the MIME (Multipurpose Internet Mail Extensions) types that the browser can support, such as JPEG, GIF, and so on, in an array of strings. You can find a a list of registered MIME types from ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/.

onLine

           

x

x

x

x

 

Read-only

 

Indicates whether the system is in global offline mode (in which case onLine is false) or global online mode (in which case onLine is true). The Internet Explorer uses this property to determine whether the computer is connected to the Interneteven though it's often possible to perform actions in the Internet Explorer that make it think it's offline when in fact it's not. If the Internet Explorer thinks you're offline, it won't even try to access the Internet without first asking you whether it should connect.

oscpu

     

x

           
 

Read-only

 

Similar to the Internet Explorer cpuClass property, this property returns a string that holds information about the browser's machine environment. This property can give considerable information, such as what hardware is supporting a particular version of UNIX. However, the information you'll get varies considerably by operating system. On a Windows 2000 machine, for example, this property holds only "Windows NT 5.0," Microsoft's internal designation for Windows 2000.

platform

   

x

x

   

x

x

x

x

 

Read-only

 

Holds the operating platform as a string. An operating platform is like an operating system, but is not necessarily as complete as a full operating system. Windows 3x was considered an operating platform, not an operating system, for example. Here are some possible values: "HP-UX" for HP UNIX-based computers, "MacPPC" for Macintosh PowerPC-based computers, "Mac68K" for Macintosh 68K-based computers, "SunOS" for Solaris-based computers, "Win32" for 32-bit Windows, "Win16" for 16-bit Windows, and "WinCE" for Windows CE.

plugins

   

x

x

x

   

x

x

x

 

Read-only

 

Holds an array of all <EMBED> elements within the document. Currently, this is really the same as the document object's embeds property, using the Netscape Navigator name plug-in instead, and included in the Internet Explorer for compatibility. (Netscape Navigator introduced plug-ins before Internet Explorer introduced <EMBED> elements, but W3C has gone with the term embed .)

product

     

x

           
 

Read-only

 

Netscape Navigator 6.0 was developed as an open -source browser, which means other vendors can adapt the browser engine for themselves . The product , productSub , vendor , and vendorSub let other vendors fill in their own identification information. The product and productSub ( sub indicates a secondary information field) hold information about the browser itself, and vendor and vendorSub hold information about the vendor.

productSub

     

x

           
 

Read-only

 

Netscape Navigator 6.0 was developed as an open-source browser, which means other vendors can adapt the browser engine for themselves. The product , productSub , vendor , and vendorSub let other vendors fill in their own identification information. The product and productSub ( sub indicates a secondary information field) hold information about the browser itself, and vendor and vendorSub hold information about the vendor.

securityPolicy

   

x

x

           
 

Read-only

 

Holds a string specifying cryptographic information the browser uses. In the Internet Explorer, use the document.security property; see Chapter 9, "Using the document and body Objects."

systemLanguage

           

x

x

x

x

 

Read-only

 

Holds the operating system language as a string. See "Using the browserLanguage , systemLanguage ,l and userLanguage Properties" in this chapter.

userAgent

x

x

x

x

x

x

x

x

x

x

 

Read-only

 

Holds information about the browser in string format. This property is usually the best one for determining browser version information. See "Detecting Browser and Version" and "Using the userAgent Property" in this chapter for the details.

userLanguage

           

x

x

x

x

 

Read-only

 

Retrieves the operating system's natural language setting as a string. See "Using the browserLanguage, systemLanguage, and userLanguage Properties Properties" in this chapter

userProfile

           

x

x

x

x

 

Read-only

 

Gives you access to a user 's profile information stored in the machine. This property holds a userProfile object with methods such as getAttribute( attr ) , which gets the value of the attribute attr from the user's profile, and setAttribute( attr , value [, flags ]) , where attr is the name of an attribute, value is the value you want to set for this attribute, and flags is 1 (the default) if attr is case-sensitive and 0 if not.

vendor

     

x

           
 

Read-only

 

Netscape Navigator 6.0 was developed as an open-source browser, which means other vendors can adapt the browser engine for themselves. The product , productSub , vendor ,and vendorSub let other vendors fill in their own identification information. The product and productSub ( sub indicates a secondary information field) hold information about the browser itself, and vendor and vendorSub hold information about the vendor.

vendorSub

     

x

           
 

Read-only

 

Netscape Navigator 6.0 was developed as an open-source browser, which means other vendors can adapt the browser engine for themselves. The product , productSub , vendor ,and vendorSub let other vendors fill in their own identification information. The product and productSub ( sub indicates a secondary information field) hold information about the browser itself, and vendor and vendorSub hold information about the vendor.



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net