Sybernet / Supplied Packages Reference
Release 3.00
Feb 22, 2003
backwards forwards

HTTP.NAVIGATOR

The NAVIGATOR package provides subprograms for interrogating information about the browser used to connect to Sybernet. Normally, you would use JavaScript to retrieve this information, but there are times when having this information available to your PL/SQL stored procedure can eliminate a lot of extra work on your part.

The most useful function in this package is navigator.userAgent because all of the functions in this package are derived from this string. The appName function, for example, correctly returns 'Navigator' if no other compatible browser is found.

One draw-back of these functions is that they rely on Sybernet to store the HTTP_USER_AGENT environment variable when you connect to Oracle. If you do not connect with Sybernet or SQLPlus, these functions will return "undefined." If you start your session with Netscape Navigator and then switch to Safari without first logging off, the information returned will correspond to Netscape Navigator.

The other draw-back is that this usage is known as Browser Detection and is not fool-proof because browser manufactures like to put misleading information in the userAgent string. There is a fairly good write-up of Browser Detection and Cross Browser Support at Netscape DevEdge, but as often as the userAgent string changes so do links and this one is no doubt dead by the time you read this. The examples on object detection (the preferred model) are quite interesting since most of them illustrate how not to do this.

Constants

NAVIGATOR defines the following constants:

/*
** miscellaneous
*/
UNDEFINED           constant    varchar(30) := 'undefined';

/*
** appName
*/
KONQUEROR           constant    varchar(30) := 'Konqueror';
SAFARI              constant    varchar(30) := 'Safari';
OMNIWEB             constant    varchar(30) := 'OmniWeb';
OPERA               constant    varchar(30) := 'Opera';
WEBTV               constant    varchar(30) := 'WebTV';
ICAB                constant    varchar(30) := 'iCab';
MSIE                constant    varchar(30) := 'Microsoft Internet Explorer';
NETSCAPE            constant    varchar(30) := 'Netscape';

/*
** platform
*/
LINUX               constant    varchar(30) := 'Linux';
UNIX                constant    varchar(30) := 'Unix';
MACINTOSH           constant    varchar(30) := 'MacPPC';
MAC                 constant    varchar(30) := 'MacPPC';
WINDOWS             constant    varchar(30) := 'Windows';

/*
** product
*/
GECKO               constant    varchar(30) := 'Gecko';

Summary of Subprograms

Subprogram Description
appCodeName function
 
A string specifying the code name of the browser.
appName function
 
A string specifying the name of the browser.
appVersion function
 
A string specifying version information for the Navigator.
language function
 
A string representing the installed language for this Navigator.
platform function
 
A string representing the client's platform.
product function
 
Gecko is the signature of all Netscape Gecko browsers.
userAgent function
 
A string representing the value of the user-agent header sent in the HTTP protocol from client to server.
vendor function
 
Vendor describes the vendor or brand. Note that for Mozilla, the Vendor is not present.
vendorSub function
 
VersionSub describes the Vendor's version number.
version function
 
A string specifying the version number for this Navigator.

appCodeName function

Mostly harmless.

Syntax

HTTP.NAVIGATOR.APPCODENAME RETURN VARCHAR2;

Parameters

None.

Returns

A string specifying the code name of the browser.


Example

The following example illustrates how to call appCodeName:

select http.navigator.appCodeName from dual;


APPCODENAME 
--------------------------------------------------
Mozilla

appName function

appName returns the name of your browser. Since the string returned is case-sensitive, you may wish to use the defined constants in this package.

Syntax

HTTP.NAVIGATOR.APPNAME RETURN VARCHAR2;

Parameters

None.

Returns

A string specifying the name of the browser.


Example

The following example illustrates how to call appName:

select http.navigator.appName from dual;


APPNAME 
--------------------------------------------------
Netscape

appVersion function

appVersion returns the information from userAgent after the appCodeName. If you need both the major and minor release numbers (for example), then appVersion is the desired string.

Syntax

HTTP.NAVIGATOR.APPVERSION RETURN VARCHAR2;

Parameters

None.

Returns

A string specifying version information for the Navigator.


Example

The following example illustrates how to call appVersion:

select http.navigator.appVersion from dual;


APPVERSION 
--------------------------------------------------
4.61 (Macintosh; U; PPC)

language function

I'm not sure I would use this function to determine the supported language since the language information is missing in some browsers.

Syntax

HTTP.NAVIGATOR.LANGUAGE RETURN VARCHAR2;

Parameters

None.

Returns

A string representing the installed language for this Navigator.


Example

The following example illustrates how to call language:

select http.navigator.language from dual;


LANGUAGE 
--------------------------------------------------
en

platform function

This function determines the platform this browser is running from. Since the returned string is case-sensitive, you may prefer to use the platform constants defined in this package.

Syntax

HTTP.NAVIGATOR.PLATFORM RETURN VARCHAR2;

Parameters

None.

Returns

A string representing the client's platform.


Example

The following example illustrates how to call platform:

select http.navigator.platform from dual;


PLATFORM 
--------------------------------------------------
MacPPC

userAgent function

This function returns the complete HTTP_USER_AGENT environment variable. Note that this string is null if you attempt to use this function against a process that did not connect with Sybernet.

Syntax

HTTP.NAVIGATOR.USERAGENT RETURN VARCHAR2;

Parameters

None.

Returns

A string representing the value of the user-agent header sent in the HTTP protocol from client to server.


Example

The following example illustrates how to call userAgent:

select http.navigator.userAgent from dual;


USERAGENT 
--------------------------------------------------
Mozilla/4.61 (Macintosh; U; PPC)

version function

This function returns the major version number of your browser; for example, if appVersion is 4.61 (Macintosh; U; PPC), then this function returns 4.

Syntax

HTTP.NAVIGATOR.VERSION RETURN VARCHAR2;

Parameters

None.

Returns

A string specifying the version number for this Navigator.


Example

The following example illustrates how to call version:

select http.navigator.version from dual


VERSION 
--------------------------------------------------
4

product function

The string Gecko is the unique identifier for all Gecko based browsers. This is the single most important aspect of the user-agent string to detect in order to properly report Gecko usage

Syntax

HTTP.NAVIGATOR.PRODUCT RETURN VARCHAR2;

Parameters

None.

Returns

Gecko is the signature of all Netscape Gecko browsers.


Example

The following example illustrates how to call product:

select http.navigator.product from dual


PRODUCT 
--------------------------------------------------
Gecko

vendor function

The value of the Vendor/Version portion of the Gecko user-agent string is not specified by the Mozilla user-agent string reference and can be any value determined by the organization responsible for creating each particular browser based upon Gecko.

Netscape branded browsers based upon Netscape Gecko will contain the string Netscape following the Gecko/CCYYMMDD portion of the user-agent string. For example, Netscape 6.x browsers will contain Netscape6/6.x following the Gecko/CCYYMMDD and Netscape 7.x browsers will contain Netscape/7.x following Gecko/CCYYMMDD.

AOL-branded Gecko-based browsers based upon Netscape Gecko will contain the string AOL following the Gecko/CCYMMDD portion of the user-agent string. For example, AOL agents based upon Netscape Gecko will contain AOL/7.0 or AOL/8.0 depending upon their version.

CompuServe branded browsers based upon Netscape Gecko will contain the string CS 2000 7.0 following the Gecko/CCYMMDD portion of the user-agent string.

Syntax

HTTP.NAVIGATOR.VENDOR RETURN VARCHAR2;

Parameters

None.

Returns

A string specifying the vendor name for this Navigator.


Example

The following example illustrates how to call vendor:

select http.navigator.vendor from dual


VENDOR 
--------------------------------------------------
Netscape

vendorSub function

Version describes the Vendor's version number.

Syntax

HTTP.NAVIGATOR.VENDORSUB RETURN VARCHAR2;

Parameters

None.

Returns

The version number corresponding to this vendor.


Example

The following example illustrates how to call vendorSub:

select http.navigator.vendorSub from dual


VENDORSBUB 
--------------------------------------------------
7.0


See Also

Sybernet
SQLPlus
README
SP_HTML_INPUT



Sybernet is a trademark of SRI International.
Copyright © 1996-2008 SRI International. All Rights Reserved.
Denis D. Workman / http://Sybernet.sri.com/