Forums
This topic is locked
ASP Server Side Browser Detection.
Posted 14 Feb 2002 12:58:22
1
has voted
14 Feb 2002 12:58:22 Owen Eastwick posted:
Looking through my web stats the other day I saw that about 40% of visitors where using Netscape 4.0, which is much higher than I would expect. Current stats at Webmonkey etc. would suggest about 7-10% as the current average.Then I noticed this anomoly. I have installed on my PC both Netscape 4.08 and IE 6.0, when I detect the browser using the following script:
<%
user_agent = request.servervariables("HTTP_USER_AGENT"
response.write("The browser you are using is: " & user_agent)
%>
<b>Netscape gives the following result:</b>
The browser you are using is: Mozilla/4.08 [en] (WinNT; I ;Nav)
<b>IE 6.0 gives this result:</b>
The browser you are using is: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)
OK, no problem, this is pretty much what I would expect.
However when I use this piece of script, which should provide me with more information:
<%
' create an instance of the Browser Capabilities component
Set browserdetect = Server.CreateObject("MSWC.BrowserType"
' find some properties of the browser being used to view this page
browser=browserdetect.Browser
version=browserdetect.Version
majorver=browserdetect.Majorver
minorver=browserdetect.Minorver
platform=browserdetect.Platform
frames=browserdetect.Frames
tables=browserdetect.Tables
cookies=browserdetect.Cookies
javascript=browserdetect.JavaScript
' send some output to the web browser
response.write ("Browser: " & browser & "<BR>"
response.write ("Version: " & version & "<BR>"
response.write ("Majorver: " & majorver & "<BR>"
response.write ("Minorver: " & minorver & "<BR>"
response.write ("Platform: " & platform & "<BR>"
response.write ("Supports frames: " & frames & "<BR>"
response.write ("Supports tables: " & tables & "<BR>"
response.write ("Supports cookies: " & cookies & "<BR>"
response.write ("Supports JavaScript: " & javascript & "<BR>"
%>
I get this result from both browsers:
Browser: Netscape
Version: 4.00
Majorver: 4
Minorver: 00
Platform: unknown
Supports frames: True
Supports tables: True
Supports cookies: True
Supports JavaScript: True
Obviously my installation of Netscape is interfering with the detection and giving a false result in IE. This would explain the high Netscape results in my web stats, since my site is visited by a lot of other developers that may also have multiple browsers istalled.
This set me thinking, how many people are really using Netscape as an every day browser?
How many of the stats on the web are based on phantom results from developers with multiple browsers installed for testing?
Are we all killing ourselves developing cross browser compatible web sites for each other?
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo