PDA

View Full Version : Detection if user is on Mac or PC


thriller
01-14-2003, 08:46 AM
Is there a way to detect if a user uses a mac or pc with a javascript or flash movie. I need to redirect the user to two different sites because the mac srews up my layout.

I hope one of you guys can help me with this. I really apriciate it if you help.

tg
01-14-2003, 03:30 PM
in flash 5/mx getVersion() will return a string the first 3 chars will be either 'win' (windows) or 'mac' (apple) or don't know what you get with linux... havn't tested it out yet on that platform.

actually may be 'Win' and 'Mac'. play with it to find out.

Esquared
02-17-2003, 03:39 PM
Anyone know a js method as well...for instance to be used on a splash page prior to loading the swf...?

tg
02-17-2003, 04:12 PM
'navigator.platform' should return the platform the browser is running on. some possible results: 'Win32', 'Win16','Mac68k','MacPPC'... as well as others for the *nix platforms.

Esquared
02-17-2003, 10:32 PM
OK...now that I've got that javascript working (thanks by the way) I have a question about its feasability anyway. What I've done is turned my "get flash" button into a call of that detection function...and based on whether or not the user is on a Mac or PC, it automatically initiates the download of the player. I found these links by copying the links provided on the macromedia website and pasted them explicitly, rather than redirecting to their page itself. I thought this might be good so that the user didn't have to make a second click to download, but I'm not sure if it's a professional thing to do. It also pulls up a blank window and just leaves it there as it downloads. Finally, I guess I would have to update my page every time they post a different version. Do you recommend I just link to the macromedia page anyway?

THANKS!