[thelist] known strings for cgi.http_user_agent
Michael Efford
efford at iinet.net.au
Mon Feb 4 22:23:00 CST 2002
> >I am after a definitive list of cgi.http_user_agent strings so I can
> >perform pattern matching for a hit counter to find browser type.
> >
> >Even better would be to find the known patterns to filter the requests of
> >identifiable browsers... :)
>
> Which language? I have a Perl browser detect script available (though
you'll
> have to tweak the start and end bits). Tests for all sorts of Windows
(3.x -
> XP) and includes rarities as Hotjava, Omniweb, and such.
I am actually using Coldfusion. Currently my script is a huge bunch of
<cfif statements..eg..
<Cfif #browser# contains "MSIE 6.0">
Internet Explorer 6.0
<cfelseif #browser# contains "MSIE 5.5">
Internet Explorer 5.5
<cfelseif #browser# contains "MSIE 5.0">
Internet Explorer 5.0
<cfelseif #browser# contains "MSIE 4.0">
Internet Explorer 4.0
<cfelseif #browser# contains "Mozilla/4." and #browser# does not contain
"compatible">
Netscape 4.x
<cfelseif #browser# contains "Netscape6">
Netscape 6
<cfelseif #browser# contains "Opera/6" or #browser# contains "Opera 6">
Opera 6
<cfelseif #browser# contains "Opera/5">
Opera 5
<cfelseif #browser# contains "Mozilla/5" and #browser# does not contain
"Netscape">
Mozilla
<cfelse>
#browser#
</cfif>
I wanted to use a switch/case construct instead but I couldn't figure out
how to use the "contains" filter in the case values
eg.
<cfswitch expression="#browser#">
<cfcase value="MSIE 6.0">
IE 6
<cfcase value="MSIE 5.5">
IE 5.5
<cfcase value="MSIE 5.0">
IE 5
wouldn't work because the entire string is much bigger...
any thoughts on an elegant way to do this would be useful :)
thanks,
: : m i c h a e l e f f o r d
: : s o d a : : http://internet.design.curtin.edu.au/soda
More information about the thelist
mailing list