开发者

Check visitors Operating System in ColdFusion

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.


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']#">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜