I found a custom tag and just converted it over to a UDF, hope it helps!

<!--- to use just call the function --->
<cfscript>
getBrowser(cgi.http_user_agent);
</cfscript>

<!--- outputting the function --->
<cfoutput>#getBrowser.browsername# -
#getBrowser.browserVersion#</cfoutput>

<!--- here's the UDF --->
<cfscript>
function getBrowser(user_agent){
browserName="Unknown";
browserVersion="0";
if (Len(user_agent)) {
        if (Find("MSIE",user_agent)) { 
                browserName="MSIE";
        
browserVersion=Val(RemoveChars(user_agent,1,Find("MSIE",user_agent)+4));
        }
        else {
                if (Find("Mozilla",user_agent)) { 
                        if (not Find("compatible",user_agent)) { 
                                browserName="Netscape";
        
browserVersion=Val(RemoveChars(user_agent,1,Find("/",user_agent)));
                        }
                        else {
                                browserName="compatible";       
                        }
                }
                if (Find("ColdFusion",user_agent)) { 
                        browserName="ColdFusion";
                }
        }
}
getBrowser.browserName=browserName;
getBrowser.browserVersion=browserVersion;
}
</cfscript>



______________________
steve oliver
cresco technologies, inc.
http://www.crescotech.com


-----Original Message-----
From: Russel Madere [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 21, 2002 3:55 PM
To: CF-Talk
Subject: Browser Detection UDF


Does anyone have a UDF that will detect the type and version of a user's
browser?

I checks CFLib.org and could not find one.  I can probably write one,
but I need the time to do it and it is outside of the domain of the
current application I am working on.

Russel

______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to