tags:

views:

132

answers:

1

Paul Silver had this post 7 years ago to check various browsers. Has there been an updated script since then? What I'd like is an if/then construct to tell what Operating System the user is on - it doesn't have to go all the way down to the browser version. I'm using the cgi.user_agent string to infer what OS they're using.

+6  A: 

Hi, by doing:

<cfdump var="#cgi.HTTP_USER_AGENT">

You will be able to detect what user agent is making the request.

On that line, you will see something like this:

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729) 

And there is your operating system.

Hope it helps

UPDATE:

And just in case you're curious to know what the OS name is for the server hosting your application, you can simply use this:

<cfset system = CreateObject("java", "java.lang.System").getProperties()>
<cfdump var="#system['os.name']#">
Marcos Placona