W3C home > Mailing lists > Public > www-html@w3.org > August 2000

browser detection

From: Palmer, Rex <rpalmer@elcom.com>
Date: Thu, 10 Aug 2000 17:41:59 -0400
Message-ID: <11264C8553CBD211BA240090273020FA42EC65@heiniken.elcom.com>
To: "Html Mailing List (E-mail)" <www-html@w3.org>
Greetings, all.  
I wonder if anyone can help me with a cleaner type of browser detection than
the one I am using (see below).  The problem with this script is that it
relies on a little file called "browscap.ini" installed by Microsoft
Internet Information Server.  This file functions as a look-up table of
various versions of various browsers.  But as near as I can tell, recent IIS
installations include a browscap.ini file that does not have a definition
for Internet Explorer 5 or 5.5. (??!!)   So every time I set up a new
server, I have to manually install the right file.  

There must be a better way to do this.  Any suggestions?

-Rex Palmer


var bType = Server.CreateObject ("MSWC.BrowserType"); 
var bName = "" + bType.browser; 
var bMajorVersion = "" + bType.majorver; 
var br; if(bName == "IE" && bMajorVersion >= 5) br = "e5"; 
else if (bName == "Netscape"){ if((bMajorVersion == "") || (bMajorVersion ==
"undefined")){ br = "n4"; } 
else if(bMajorVersion >= 4){ br = "n4"; } } 
else if (bName == "IE" && bMajorVersion >= 4) br = "e4"; 
Received on Thursday, 10 August 2000 17:44:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:43 GMT