|
Q1806 How would I determine if the visitor's platform is either a Mac or a Windows machine and send them to the appropriate directory on my server?
irt.org | Knowledge Base | JavaScript | Link | Q1806 [ previous next ]
Q1806 How would I determine if the visitor's platform is either a Mac or a Windows machine and send them to the appropriate directory on my server?
Try:
<html>
<head>
<script>
appVer = navigator.appVersion.toLowerCase();
win = (appVer.indexOf('win') !=-1)?1:0;
mac = (appVer.indexOf('mac') !=-1)?1:0;
href = window.location.href.toLowerCase();
macDir = (href.indexOf('/mac') !=-1)
currentPage = href.substring(href.lastIndexOf('/'));
if (win && macDir) window.location = '/windows'+currentPage;
else if (mac && !macDir) window.location = '/mac'+currentPage;
</script>
</head>
|
|
|
Copyright © 1996-2009 irt.org, All Rights Reserved.