PDA

View Full Version : test for Mac


dreamingdigital
11-29-2002, 05:52 PM
Hi

I need a script that detects if the user is using a Mac or if the user is using Windows.

Colin

chrismiceli
11-29-2002, 06:20 PM
yeah, here is a link to do it
http://www.javascriptkit.com/script/cut22.shtml
or you could do it the easy way
alert(navigator.platform);

dreamingdigital
12-02-2002, 08:08 AM
Found it



//__OS Detection Code modified from www.mozilla.org/
var mac = (navigator.userAgent.toLowerCase().indexOf("mac")!=-1) ? true: false;
var mac68k = (mac && ((navigator.userAgent.toLowerCase().indexOf("68k")!=-1) || (navigator.userAgent.toLowerCase().indexOf("68000")>-1))) ? true: false;
var macppc = (mac && ((navigator.userAgent.toLowerCase().indexOf("ppc")!=-1) || (navigator.userAgent.toLowerCase().indexOf("powerpc")>-1))) ? true: false;