PDA

View Full Version : dectecting windows / mac os / linux ???


Alias
03-30-2003, 07:28 PM
How to detect operational system ?
(windows / mac os / linux)


Best Regards

liorean
03-30-2003, 08:14 PM
var mac= /mac/i.test(navigator.platform);
var win= /win/i.test(navigator.platform);
var unix= /lin|unix|x11/i.test(navigator.platform);

Alias
04-01-2003, 04:38 PM
thanx :thumbsup:

liorean
04-01-2003, 04:53 PM
Note, however that what I wrote there doesn't cover ALL unices, or other POSIX conforming systems. Also, I have no idea how BeOS, AmigaOS, OS/2, Plan9, DOS, HURD etc. would be presented.

brothercake
04-01-2003, 07:18 PM
If you identify Windows and Mac then I think you can fairly safely call everything else "unix" without upsetting too many people; certainly for practical purposes, if you don't specifically test in multiple OSs there's no point sniffing for them - you only normally need to know if it's 'win', 'mac', or 'something else'

liorean
04-01-2003, 08:03 PM
Actually, you might be interested in linux/unix too. For example if you're going to determine what version of an executable the user will want to download.