Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6024105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:06:23+00:00 2026-05-23T04:06:23+00:00

Is there something built into Coldfusion that would let me know the browser and

  • 0

Is there something built into Coldfusion that would let me know the browser and version number surfing my site? Are there existant libraries that would enable me to do this?

My google-fu hasn’t shown many things other than simple if statements detecting IE.

I did do a dump of the cgi.http_user_agent variable in Chrome:

Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Safari/534.24

There’s three different browsers mentionned in there! Doing an if statement looking for either would return true. There’s got to be a more formal approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:06:24+00:00Added an answer on May 23, 2026 at 4:06 am

    There is a User-Defined Function which can parse out the user_agent string.

    browserDetect

    <cfscript>
    /**
     * Detects 130+ browsers.
     * v2 by Daniel Harvey, adds Flock/Chrome and Safari fix.
     * 
     * @param UserAgent      User agent string to parse. Defaults to cgi.http_user_agent. (Optional)
     * @return Returns a string. 
     * @author John Bartlett (jbartlett@strangejourney.net) 
     * @version 4, June 28, 2009 
     */
    function browserDetect() {
    
    // Default User Agent to the CGI browser string
    var UserAgent=CGI.HTTP_USER_AGENT;
    
    // Regex to parse out version numbers
    var VerNo="/?v?_? ?v?[\(?]?([A-Z0-9]*\.){0,9}[A-Z0-9\-.]*(?=[^A-Z0-9])";
    
    // List of browser names
    var BrowserList="";
    
    // Identified browser info
    var BrowserName="";
    var BrowserVer="";
    
    // Working variables
    var Browser="";
    var tmp="";
    var tmp2="";
    var x=0;
    
    
    // If a value was passed to the function, use it as the User Agent
    if (ArrayLen(Arguments) EQ 1) UserAgent=Arguments[1];
    
    // Allow regex to match on EOL and instring
    UserAgent=UserAgent & " ";
    
    // Browser List (Allows regex - see BlackBerry for example)
    BrowserList="1X|Amaya|Ubuntu APT-HTTP|AmigaVoyager|Android|Arachne|Amiga-AWeb|Arora|Bison|Bluefish|Browsex|Camino|Check&Get|Chimera|Chrome|Contiki|cURL|Democracy|" &
                "Dillo|DocZilla|edbrowse|ELinks|Emacs-W3|Epiphany|Galeon|Minefield|Firebird|Phoenix|Flock|IceApe|IceWeasel|IceCat|Gnuzilla|" &
                "Google|Google-Sitemaps|HTTPClient|HP Web PrintSmart|IBrowse|iCab|ICE Browser|Kazehakase|KKman|K-Meleon|Konqueror|Links|Lobo|Lynx|Mosaic|SeaMonkey|" &
                "muCommander|NetPositive|Navigator|NetSurf|OmniWeb|Acorn Browse|Oregano|Prism|retawq|Shiira Safari|Shiretoko|Sleipnir|Songbird|Strata|Sylera|" &
                "ThunderBrowse|W3CLineMode|WebCapture|WebTV|w3m|Wget|Xenu_Link_Sleuth|Oregano|xChaos_Arachne|WDG_Validator|W3C_Validator|" &
                "Jigsaw|PLAYSTATION 3|PlayStation Portable|IPD|" &
                "AvantGo|DoCoMo|UP.Browser|Vodafone|J-PHONE|PDXGW|ASTEL|EudoraWeb|Minimo|PLink|NetFront|Xiino|";
                // Mobile strings
                BrowserList=BrowserList & "iPhone|Vodafone|J-PHONE|DDIPocket|EudoraWeb|Minimo|PLink|Plucker|NetFront|PIE|Xiino|" &
                "Opera Mini|IEMobile|portalmmm|OpVer|MobileExplorer|Blazer|MobileExplorer|Opera Mobi|BlackBerry\d*[A-Za-z]?|" &
                "PPC|PalmOS|Smartphone|Netscape|Opera|Safari|Firefox|MSIE|HP iPAQ|LGE|MOT-[A-Z0-9\-]*|Nokia|";
    
                // No browser version given
                BrowserList=BrowserList & "AlphaServer|Charon|Fetch|Hv3|IIgs|Mothra|Netmath|OffByOne|pango-text|Avant Browser|midori|Smart Bro|Swiftfox";
    
                // Identify browser and version
    Browser=REMatchNoCase("(#BrowserList#)/?#VerNo#",UserAgent);
    
    if (ArrayLen(Browser) GT 0) {
    
        if (ArrayLen(Browser) GT 1) {
    
            // If multiple browsers detected, delete the common "spoofed" browsers
            if (Browser[1] EQ "MSIE 6.0" AND Browser[2] EQ "MSIE 7.0") ArrayDeleteAt(Browser,1);
            if (Browser[1] EQ "MSIE 7.0" AND Browser[2] EQ "MSIE 6.0") ArrayDeleteAt(Browser,2);
            tmp2=Browser[ArrayLen(Browser)];
    
            for (x=ArrayLen(Browser); x GTE 1; x=x-1) {
                tmp=Rematchnocase("[A-Za-z0-9.]*",Browser[x]);
                if (ListFindNoCase("Navigator,Netscape,Opera,Safari,Firefox,MSIE,PalmOS,PPC",tmp[1]) GT 0) ArrayDeleteAt(Browser,x);
            }
    
            if (ArrayLen(Browser) EQ 0) Browser[1]=tmp2;
        }
    
        // Seperate out browser name and version number
        tmp=Rematchnocase("[A-Za-z0-9. _\-&]*",Browser[1]);
    
        Browser=tmp[1];
    
        if (ArrayLen(tmp) EQ 2) BrowserVer=tmp[2];
    
        // Handle "Version" in browser string
        tmp=REMatchNoCase("Version/?#VerNo#",UserAgent);
    
        if (ArrayLen(tmp) EQ 1) {
            tmp=Rematchnocase("[A-Za-z0-9.]*",tmp[1]);
            BrowserVer=tmp[2];
        }
    
        // Handle multiple BlackBerry browser strings
        if (Left(Browser,10) EQ "BlackBerry") Browser="BlackBerry";
    
        // Return result
        return Browser & " " & BrowserVer;
    
    }
    
    // Unable to identify browser
    return "Unknown";
    
    }
    </cfscript>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, is there any built in functions or something like that in php that
Are there any good code profilers/analyzers for Erlang? I need something that can build
Is there something like InstallShield that I can use for free?
Is there something like Python's getattr() in C#? I would like to create a
Is there something like a panel that I can use in a MFC application.
Is there something similar to sprintf() in C#? I would for instance like to
Is there something like python's interactive REPL mode, but for Java? So that I
I have all this JSON text that I want to deserialize (or something) into
Is there something like the Python descriptor protocol implemented in other languages? It seems
Is there something special about Safari for Windows and AJAX? In other words: Are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.