You should probably use Javascript. Heres something i found .
The javascript "appVersion" string varies in the way it names operating systems and where it places the name in the string. For example, Microsoft Windows might be called "WinPC", "Win95", "Win98", "WinNT", "Windows NT", "Windows 95", and so on, possibly with variation between upper and lower case. But one thing is fairly certain: anything running Windows has the string "win" somwhere in it (even if there are more letters as well), and a Mac browser always has the string "mac" (even if the full string is "Macintosh").
<script>
version = navigator.appVersion;
if (version.toLowerCase().indexOf("win")!=-1) location = "winpage.htm";
else if (version.toLowerCase().indexOf("mac")!=-1) location = "macpage.htm";
else location = "otherpage.htm";
<script>
http://www.imint.com/support/sp054.htm