Redirect Website to PC/Windows, Mac and Linux/Ubuntu Version

Here is a JavaScript code snippet for PC/Windows, Mac and Linux/Ubuntu User Agent Detection and then redirecting them to their version of website. Earlier I’d also posted how we can easily redirect website to their respective iPhone/iPod/iPad version, you might like to check that out as well. Replace PC Version with PC Version of your Website and Mac Version for Mac Version of your Website and Linux Version with Linux Version of your Website in the below code.

<script type="text/javascript">
    if ((navigator.userAgent.match(/MSIE/i)) || (navigator.userAgent.match(/Windows/i))) {
        location.replace("PC Version");
    } else if (navigator.userAgent.match(/Macintosh/i)) {
        location.replace("Mac Version");
    } else if (navigator.userAgent.match(/Linux/i)) {
        location.replace("Linux Version");