Reputation: 96836
Is there a way to determine which OS is the browser being run on?
I have an NPAPI plugin which, at the moment, can only function on Linux and I would like to alert users if they try using the plugin on !Linux machines.
Upvotes: 0
Views: 551
Reputation: 536715
navigator.platform.substring(0, 5)==='Linux'
Opera reports only Linux
for navigator.platform
. Mozilla and Chromium also give the arch name, eg. Linux i686
or Linux x86_64
, which may be of interest if your plugin isn't available for all architectures.
If you want to also allow other Unix platforms which might possibly be able to run an ELF NPAPI plugin, you could instead look for the substring X11
in navigator.platform.appVersion
, perhaps, though this is a bit woolly.
Upvotes: 1
Reputation: 34692
PPK has a script over at quirksmode.com that will probably work for you.
Upvotes: 5
Reputation: 3529
A simple google search turned up the following: http://www.javascripter.com/faq/operatin.htm
Upvotes: 0