Here is the exact code I use:
<cfif NOT isDefined("SESSION.Browser")>
<cfif ListContains(CGI.HTTP_USER_AGENT, "MSIE", " ")>
<cfset SESSION.Browser = "MSIE">
<cfelse>
<cfset SESSION.Browser = "NTSCP">
</cfif>
</cfif>
I set the value once per session so using the ListContains() function isn't
too big a hit.
Then I can use the SESSION.Browser variable to determine what browser the
user has. I.E.:
<cfif SESSION.Browser EQ "NTSCP">
<!--- Netscape code goes here --->
<cfelse>
<!--- IE code goes here --->
</cfif>
When Netscape 6.0 get better, I'll add an ElseIf to detect it and have a
third variable (or possibly lump it with MSIE since they will share many of
the same features).
Russel
============================================================
Russel Madere, Jr. Senior Web Developer
ICQ: 5446158 http://www.TurboSquid.com
Some days you eat the bear; some days the bear eats you.
============================================================
> -----Original Message-----
> From: Richard L Smith [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 01, 2001 09:41
> To: CF-Talk
> Subject: Detecting HTTP_USER_AGENT
>
>
> Hello:
>
> Does any one know of a way to use HTTP_USER_AGENT to do page
> redirects with
> CF?
>
> I am trying to get a template to output code based on the browser
> type NS or
> MSIE so far nothing seems to work.
>
> Here's the code i am using so far
>
>
> <cfset "brow" eq "#HTTP_USER_AGENT#">
> <cfif "brow" eq "Mozilla/4.7 [en]">
> <cflocation url="index.cfm">
> <cfelseif "brow" EQ "Mozilla/4.01 (compatible; MSIE 4.01; Windows NT)">
> </cfif>
>
> Thanks
> Rick
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists