While it is possible to sniff out the major browsers, it may not be possible to sniff the out obscure browsers. One good reason to sniff is if your site/application is guaranteed to work with only specific browsers, versions, operating systems, etc. The detection code has to periodically modified if you wnat to detect new versions.

Object Detection

The fact that different objects are used in different browsers can be used to quickly and easily detect (aka sniff) the browser make and model on the client-side.

Object (in JS syntax) MS IE NN/NS
!document.images 3 2
document.images 4+ 3+
document.layers - 4
document.all 4+ -
document.layers||document.all NS 4+ or IE 4+
document.getElementById 5+ 6
document.getElementById&&document.all 5+ -
- 6


if (!document.images){ strBrowser = "NS2 or IE3"};
if (document.all){ strBrowser = "IE4+" };
if (document.layers){ strBrowser = "NS4" };
if (document.getElementById&&!document.all){ = "NS6" };

Here are objects, elements, tags, or styles that differ between the three dominant browser versions.

Item IE 4+ NN 4 NS 6 W3C
document.layers (<layers>)
document.ilayers (<ilayers>)
no yes no* no
<nolayer> no yes half** no
document.all yes no no no
document.getElementById() yes no yes yes
document.tags, document.ids, document.classes, and document.contextual() no yes no no
<blink> no yes yes no
style="text-decoration:blink" no yes yes yes
<marquee> yes no no no
<bgsound> yes no no no
document.styleSheet().addRule yes no no no
<div> with src attribute yes no no no
innerHTML yes no yes no
getElementsByTagName() yes no yes yes
*NS6 will ignore attributes and contents of these tag.
**NS6 will ignore attribute of this tag but will see its contents.

Navigator Object

More detailed information can be acquired about the user's browser on the client-side by utilizing the navigator object, especially three of its properties:

EG: Here are results for each corresponding property that might be returned by three different browsers. Note that in the third example, the Opera browser erroneously returned Netscape  for .appName.

Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
4.0 (compatible; MSIE 4.01; Windows 95)
Microsoft Internet Explorer
Mozilla/4.04 [en] (Win95; I)
4.04 [en] (Win95; I)
Mozilla/3.0 (compatible; Opera/3.0; Windows 95/NT4)

Lynx, the most important text-based browser, is easy to detect because its userAgent starts with "Lynx".


An ASP (Active Server Page) on the server-side can detect what is equivalent ton navigator.userAgent by using a member of the Request.ServerVariables collection.


Dim strBrowser, intVersion
strBrowser = Request.ServerVariables("HTTP_USER_AGENT")
If InStr(strBrowser, "MSIE") Then
    intVersion = CInt(Mid(strBrowser, InStr(strBrowser, "MSIE") + 5, 1))
ElseIf InStr(strBrowser, "Mozilla") Then
    If (InStrBrowser, "compatible;") = 0 Then
 'Probably Netscape
        intVersion = CInt(Mid(strBrowser, InStr(strBrowser, "/") + 1, 1))
 'Netscape compatible
    End If
 'Not MS or Netscape
End If

Here is info on your browser:

CCBot/2.0 (http://commoncrawl.org/faq/)

Browser Detection Links

Links that lead to off-site pages about browser detection.

Page Modified: (Hand noted: ) (Auto noted: )