[Javascript] Mac Sniffer

Tom Churm thomas.churm at pixelpark.com
Mon Jan 7 05:02:47 CST 2002


hi,

it's important that i find & implement a highly reliable Mac Sniffer 
and i found/adapted the following code from Netscape's "Ultimate 
JavaScript Client Sniffer" here: 

http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html

could someone please tell me if this incredibly simple code will 
suffice in sniffing out all of the various incarnations of Mac 
operating systems out there? (code follows)

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
var agt=navigator.userAgent.toLowerCase();
var is_mac    = (agt.indexOf("mac")!=-1);

if (agt.indexOf("mac")!=-1) {
window.location.href = "for_mac.html";
}
else {
window.location.href = "for_pc.html";
}
//-->
</SCRIPT>

it seems to work--it's just that i don't have a lot of different Macs 
at my disposal to test this on.

muchos gracias,

tom



More information about the Javascript mailing list