Sybernet / Supplied Packages Reference
Release 3.00
Mar 12, 2005
backwards forwards

HTTP.NAVIGATOR

The NAVIGATOR "package" is a program 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 Transact-SQL stored procedure can eliminate a lot of extra work on your part.

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

One draw-back of this program is that it relies on Sybernet to store the HTTP_USER_AGENT environment variable when you connect to Sybase. If you do not connect with Sybernet or ISQL, these parameters 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.

Syntax

procedure navigator
(
    @userAgent              VARCHAR(255) = NULL OUT 
,   @appCodeName            VARCHAR(255) = NULL OUT
,   @appVersion             VARCHAR(255) = NULL OUT
,   @appName                VARCHAR(255) = NULL OUT
,   @language               VARCHAR(255) = NULL OUT
,   @platform               VARCHAR(255) = NULL OUT
,   @version                VARCHAR(255) = NULL OUT
,   @product                VARCHAR(255) = NULL OUT
,   @vendor                 VARCHAR(255) = NULL OUT
,   @vendorSub              VARCHAR(255) = NULL OUT 
)

Parameters

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

Example

The following example illustrates how to call navigator:

declare
    @appName varchar(255)
,   @appVersion varchar(255)
begin
    exec http.dbo.navigator

        @appName    = @appName    output
    ,   @appVersion = @appVersion output

    if (@appName='Netscape' and @appVersion < '5.0')
        select 'true'
    else
        select 'false'
end


See Also

Sybernet
ISQL
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/