Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtaining browser and version using Coldfusion

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?

like image 794
TechFanDan Avatar asked Jun 09 '11 14:06

TechFanDan


1 Answers

This is much easier than the complicated function submitted earlier...

<CFIF FindNoCase('Chrome','#CGI.HTTP_USER_AGENT#') GREATER THAN 0>
  <CFSET browser = 'Chrome'>
</CFIF>

credit: http://www.paulsilver.co.uk/code/coldfusion_detect_browser.php

like image 89
Klog Avatar answered Nov 09 '22 09:11

Klog