Forum Moderators: travelin cat
Check your logs for the user agent strings.
e.g.:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)"
That's a windows based firefox (tainted by the .net plugin)
e.g.:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
That's the same version of Firefox on an intel mac and PowerPC mac respectively.
e.g.:
Safari windows:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3
Safari mac:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9
e.g.:
Opera 10 windows:
Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.00
Opera 10 mac:
Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00
e.g.:
Chrome on windows:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0
Chromium on mac:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/4.0.222.5 Safari/532.2
From the sample above it feels safe to say that if you find
"Mozilla/5.0 (Macintosh;" at the beginning of the user agent string that you're dealing with a mac user. Since that excludes browsers that do not claim to be netscape (a trend started by MSFT during the browser wars),
Just match on "(Macintosh;" being part of the user agent string.