Monday, October 25, 2010

Detect Windows 7 Users from Web Site

I had to tinker with this for two separate projects, so hopefully it’s of use to someone else.  Not really rocket science, but then again: web pages are never rocket science are they?

PHP code

function isWin7() {
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Windows NT 6.1') == true) {
return true;
return false;

ASP code

Function isWin7() {
If InStr(Request.ServerVariables("HTTP_USER_AGENT"),"Windows NT 6.1") > 0 Then
isWin7 = True
End If
End Function
Post a Comment