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.
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.
A simple google search turned up the following: http://www.javascripter.com/faq/operatin.htm
PPK has a script over at quirksmode.com that will probably work for you.
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.