View Full Version : OS detection script

09-25-2003, 03:19 PM
Hi everybody,

I am looking for a script that will detect the user's os system, specifically detect if the user is using a Mac or a PC. Then, according to the os, it will direct them to the appropriate web pages. Anybody knows where I can find such a script? I made a search, and I found scripts that detect the browser only, could not find anything about the os.

Thanking you i8n advance


09-25-2003, 03:23 PM
var os = navigator.platform.toLowerCase();
var mac = (os.indexOf("mac")!=-1) ? true:false;
var win = (os.indexOf("win")!=-1) ? true:false;

09-25-2003, 03:31 PM
Thank you so much Glenn.

I appreciate your help

09-25-2003, 03:38 PM
One other quick question... just to make sure I get it correctly.

Am I to understand that I name my files, in this example mac.htm and win.htm ?
And I make these modifications to the script

Thanks again

09-25-2003, 05:42 PM
PLease, somebody...

I just can't make it work, the mechanism escapes me
Can you give me some clues?

Presently I have an index file (index.htm) which is the same for all. Then users will have to be channeled to the appropriate Mac or PC pages (say mac.htm & win.htm. How will that happen

Have I got it all wrong???

09-25-2003, 08:43 PM
IT's OK now, I managed
Thanks anyway