The Navigator Object

This object provides detailed information about the current browser, including its name and possibly the build number and even operating system. The sample output we got from our copies of the Windows NT 4.0 version of Internet Explorer 3.01 and Netscape Navigator 3.01 are outlined in the table below:

Caption: Navigator Object Results with Internet Explorer 3.01

Property Value
appCodeName
Mozilla
appName
Microsoft Internet Explorer
appVersion
2.0 (compatible; MSIE 3.01; Windows NT)
userAgent
Mozilla/2.0 (compatible; MSIE 3.01; Windows NT)

Caption: Navigator Object Results with Netscape Navigator 3.01

Property Value
appCodeName
Mozilla
appName
Netscape
appVersion
3.01 (WinNT; I)
userAgent
Mozilla/3.01 (WinNT; I)

You’ll probably notice a few things about these results. Firstly, the

userAgent
property is the same as if we'd examined
Request.ServerVariables(HTTP_USER_AGENT)
on the server with ASP code. Secondly, the
userAgent
property is the concatenation of the
appCodeName
and
appVersion
properties. Thirdly, the odd names and divisions for these properties. Don’t spend too much time thinking about it— it’s what Netscape came up with when they wrote Navigator 2.0. Some of the original developers of Navigator also worked on Mosaic—the browser that started it all. They wanted Navigator to be a gorilla that would stomp all over Mosaic, hence the name.

So, if we’d like to take some action on the client depending on the exact browser version that someone viewing our pages is using, the

Navigator
object is the way to go. To do the same thing on the server with ASP, we can use either the
HTTP_USER_AGENT
header, or the more capable and powerful Browser Capabilities component.

© 1997 by Wrox Press. All rights reserved.

Show: