please dont rip this site
The Navigator Object

The Navigator object represents the particular browser and allows script functions to access information about the browser being used to access the document.

The Navigator object provides information about the browser that the user is currently using. All the properties are read-only and can not be dynamically changed. Typically the Navigator object properties are used to determine the users browser and navigate to sections of the site containing browser-specific content.

Note : The examples below are targeted at the Window range of platforms (3.1(1), Windows 95 and Windows NT) - this reference does not support possible cross-platform differences for browsers.

Navigator Properties
appCodeName
The appCodeName property returns the code name of the current browser. For example :

vCodeName=navigator.appCodeName

would store the current browsers appCodeName property in the variable vCodeName. The navigator.appCodeName value for both Netscape and Internet Explorer is 'Mozilla'.

appMinorVersion
The Internet Explorer 4.0 specific appMinorVersion property returns the minor version of the navigator object (the users browser). For example, Internet Explorer 4.0 would return 0, a version of Internet Explorer 4.1 would return 1. This will prove useful for browser-determination scripting for future browser versions.

appName
The appName property returns the name of the current browser. For example :

vName=navigator.appName

would store the current browsers appName property in the variable vName. The navigator.appName values for Netscape and Internet Explorer are 'Netscape' and 'Microsoft Internet Explorer' respectively.

appVersion
The appVersion property returns the version of the current browser. For example :

vVersion=navigator.appVersion

would store the current browsers appVersion property in the variable vVersion.
The Netscape navigator.appVersion string contains information of the following format :

<version> (<Operating_System>; I)

where <Operating_System> is 'Win16', 'Win95', or 'WinNT'. For example, for Netscape 3.0 on the Windows 95 platform, the navigator.appVersion string would be :

3.0 (Win95; I)

The Internet Explorer navigator.appVersion string contains information of the following format :

<compatible_Netscape_version> (compatible; <version>; <Operating_System>)

Where <compatible_Netscape_version> is 2.0 for Internet Explorer 3.01 (and 3.02) and <Operating_System> is either 'Windows 3.1(1)', 'Windows 95' or 'Windows NT'. For example, for Internet Explorer 3.02 on the Windows 95 platform, the navigator.appVersion string would be :

2.0 (compatible; MSIE 3.02; Windows 95)

browserLanguage
The Internet Explorer 4.0 specific browserLanguage returns the ISO code representing the localised language of the users browser. For example, a german Internet Explorer would return 'DE' for the browserLanguage property. (see language property for Netscape determination of the users browser language.)

connectionSpeed
The Internet Explorer 4.0 specific connectionSpeed property returns a value representing the speed of the users current connection. This proves useful for possible re-direction of users to less multimedia-heavy versions of sites, if their connections aren't enough for the site content.

cookieEnabled
The Internet Explorer 4.0 specific cookieEnabled property returns a boolean value representing whether or not the user has cookies enabled in the browser.

cpuClass
The Internet Explorer 4.0 specific cpuClass property returns a value representing the class of processor on the users machine. For example 'x86' for 486/Pentium etc. machines, 'Alpha' for Digital machines etc.

language
The Netscape 4.0 specific language property reflects the current language translation of the Navigator client being used. It returns ISO standard country codes, depending on the version; for example en for English versions, fr for French versions etc. (see browserLanguage property for Internet Explorer determination of the users browser language.)

mimeTypes
The mimeTypes property is supported by Internet Explorer 4.0, although it returns no values. It has been added to the Internet Explorer 4.0 object model, to retain compatibility with Netscape browsers. Netscape supports the mimeTypes property of the navigator object as containing an array detailing all the mimeTypes that the users browser can handle, either natively, by helper applications, or by plug-in modules. As an object, it has its own properties, which are :

type
Details the particular MIME type that is handled by the particular plug-in. For example, the LiveAudio plug-in (as standard with Netscape), handles (amongst others), the MIME-type : audio/x-wav
description
A description of the particular MIME type. For example, the description of the above LiveAudio handled MIME type is : WAV
enabledPlugin
This gives a reference to whether the particular MIME type is to be handled by a Plug-in. It details whether the particular plug-in is enabled or not.
suffixes
This gives the suffixes (file extensions) of the file types of the particular MIME types. For example, the suffix for the above MIME type is wav
length
This returns the total number of MIME types that Netscape can handle, internally, or via installed plug-ins.

As an example, the following code section checks to see whether the user has a suitable VRML plug-in available and if so, displays a VRML world, giving a notice if the plug-in isn't available :

var vVRMLallowed = navigator.mimeTypes["x-world/x-vrml"]
if (vVRMLallowed)
document.writeln("Click <A HREF='htmlib.wrl'>here</A> to see a " + vVRMLallowed.description)
else
document.writeln("Too bad, can't show you any virtual worlds.")

NOTE : See how it's possible to reference MIME types in the mimeTypes object by its actual type property. The type and description properties can be used in this way.

onLine
The Internet Explorer 4.0 specific onLine property returns a boolean (i.e true or false) value depending on whether the user has chosen to 'Work Offline' - a feature of Internet Explorer 4.0 whereby pages can still be viewed directly from the cache. A value of true shows that the user is currently 'on-line' (or has not chosen the 'Work Offline' option - but may still be disconnected); a value of false indicates that the browser is 'Offline'.

platform
The platform property reflects the machine type that the browser is currently running on. For example, on the WindowsNT platform, navigator.platform returns Win32.

plugins
The plugins property is different for both browsers. For more details, see the PlugIns collection.

systemLanguage
The Internet Explorer 4.0 specific systemLanguage property returns a value indicating the language of the users system (as opposed to browserLanguage which returns the localised language of the browser). If you're site is authored in multiple languages, interrogating the systemLanguage property would allow re-direction to the appropriate content.

userAgent
The userAgent property returns a property which is the combination of appCodeName and appVersion properties for the the current browser. For example :

vuAgent=navigator.userAgent

would store the current browsers userAgent property in the variable vuAgent.
Both Netscapes and Internet Explorers navigator.userAgent string is of the format :

appCodeName/appVersion

So, using the above examples, Netscape 3.0 on the Windows 95 platform returns :

Mozilla/3.0 (Win95; I)

while Internet Explorer 3.02 on the Windows 95 platform returns :

Mozilla/2.0 (compatible; MSIE 3.02; Windows95)

for the navigator.userAgent value.

userLanguage
The Internet Explorer 4.0 specific userLanguage property is synonymous with the browserLanguage property and returns a value representative of the users current language settings.

userProfile
The Internet Explorer 4.0 specific userProfile property provides a way for determining any of the 'Profile' properties that the user has set in Internet Explorer (View|Internet Options|Content|Personal Information). Specifically, it allows the following methods:

addReadRequest
sets an entry in the 'Read Request' queue
clearRequest
clears the current request queue, ready for more addReadRequests to be set
doReadRequest
performs the read requests as queued by the addReadRequest method
getAttribute
get values from the users 'Personal Information' store, ready for use later

The syntax for these methods is as follows:

navigator.addReadRequest (attribute [,isRequired], success)
The attribute argument specifies the personal information that the script wishes to obtain from the user. isRequired is reserved for future versions of Internet Explorer 4.0 and is currently ignored and success returns a boolean value - true if the request has been added to the queue, false if it hasn't. See the getAttribute method (below) for details of the possible attributes that can be retrieved from the personal information store.

navigator.clearRequest
Clears any requests queued by the addReadRequest method.

navigator.doReadRequest (usageCode [, friendlyName [, domain [, path [, expiration]]]])
The doReadRequest method performs the request for the information asked for in the request queue. For obvious security reasons, no script can access any users personal information settings without them knowing and when the doReadRequest method is used, the user is presented with a dialog, telling them that their information has been requested, also giving them the chance to deny the information to the requesting script. usageCode is any of the following codes, as defined by the Internet Privacy Working group:

Code Meaning
0 Used for system admin.
1 Used for research/development
2 Used for completion/support of a current transaction
3 Used for site customisation
4 Used to improve (i.e. target) advertising on site
5 Used to notify visitors about updates to the site
6 Used for marketing departments to contact site visitors
7 Used for linking other collected information
8 Used by the site for other purposes
9 Disclosed to others for customisation of sites
10 Disclosed to others for marketing purposes
11 Disclosed to others who may contact you for marketing, but will request your permission first
12 Disclosed to others for any purpose

This information is passed to the user in the 'Privacy' section of the request dialog box, giving them an idea of the intended use of the personal information by the script/script author.

var = navigator.getAttribute (attributeName, attributeValue)
The getAttribute method is used after the Request queue has been set up and the doReadRequest method has been called to alert the user that the script function is attempting to retrieve personal information. If the attributeName argument is left blank, then nothing is returned. Setting anything for the attributeValue argument currently causes a scripting error. The various attribute properties that can be requested are of the form vCard.property and can be any of the following:

vCard.Email vCard.DisplayName
vCard.FirstName vCard.LastName
vCard.MiddleName vCard.Cellular
vCard.Gender vCard.JobTitle
vCard.Pager vCard.Company
vCard.Department vCard.Notes
vCard.Office vCard.Homepage
vCard.Home.StreetAddress vCard.Home.City
vCard.Home.State vCard.Home.Zipcode
vCard.Home.Country vCard.Home.Phone
vCard.Home.Fax vCard.Business.StreetAddress
vCard.Business.City vCard.Business.Phone
vCard.Business.Fax vCard.Business.URL
vCard.Business.State vCard.Business.Country
vCard.Business.Zipcode

which all correspond to information contained in the personal information store of Internet Explorer

userProfile example
Clicking the button above the following text fields requests various information from you, which you can allow, or deny, for the usage code (see above) chosen from the code box. If you allow the information, it will the be filled in in the text fields.


Your Name
Your e-mail
Your homepage

To do this, it runs the following script functions:

navigator.userprofile.addreadrequest("vcard.displayname")
navigator.userprofile.addreadrequest("vcard.email")
navigator.userprofile.addreadrequest("vcard.homepage")
navigator.userprofile.doreadrequest <usageCode>,"The HTML Reference Library"
name = navigator.userprofile.getattribute("vcard.displayname")
email = navigator.userprofile.getattribute("vcard.email")
URL=navigator.userprofile.getattribute("vcard.homepage")

where <usageCode> is the number provided by the list box

Navigator Methods
javaEnabled
The javaEnabled method can be used to determine whether the user has Java capabilities enabled in their browser. For example :

if (navigator.javaEnabled()) {
doSomeJavathing()
}
else doSomethingElse()

would execute the doSomeJavathing() code if the user has Java enabled, or do the doSomethingElse() code if Java is disabled.

taintEnabled
Note that the taintEnabled method is understood by Internet Explorer, but it always returns a value of 'false' as data tainting isn't supported by Internet Explorer. Data Tainting is the Javascript process of protecting data for sending over networks. It prevents supposedly secure and private information from being sent without the users permission. The taintEnabled method takes a boolean value which can be used to set, or remove Data tainting. For more information on Data Tainting, visit the Javascript documentation at http://www.netscape.com/.

preference
The Netscape 4.0 specific preference method can be used to set various browser preferences (that would normally be set by the user in the 'Preferences' dialog) through scripting. Obviously, this will require a signed script. For information on signed scripts, see Netscape DevEdge Online

Navigator Events
The Navigator object has no events.

See also:


file: /Techref/language/html/ib/Scripting_Reference/navo.htm, 22KB, , updated: 2004/3/1 15:47, local time: 2017/12/13 12:56,
TOP NEW HELP FIND: 
54.163.61.66:LOG IN

 ©2017 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF="http://www.piclist.com/techref/language/html/ib/Scripting_Reference/navo.htm"> The Navigator object</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2017 contributors:
o List host: MIT, Site host massmind.org, Top posters @20171213 RussellMc, Van Horn, David, Sean Breheny, James Cameron, alan.b.pearce, IVP, Neil, Bob Blick, David C Brown, John Gardner,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .