Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check in Firefox and Chrome if a plugin is installed

I'm using an embedded plugin in my web app to enable scanning (Dynamsoft's webscanning plugin). I'm serving an xpi to firefox users and a crx to chrome users. When viewing the page without the plugin installed, Firefox will try to download the plugin and the user will need to click "manual install" to install it. Chrome will make no attempt to donwload the plugin (this is by design, according to http://code.google.com/p/chromium/issues/detail?id=15745)

I would like to use javascript to detect wether the plugin is installed or not (preferrably before trying to load it through the embed tag). If no plugin is installed, I want to provide an explanation and a link to the correct plugin to the user. Both browsers install their respective plugins without any problem if the user clicks at a download link instead of just trying to load through the embed tag.

So, does anybody know a way detect wether a plugin is installed using javascript?

like image 333
Jens Alm Avatar asked Jan 08 '11 22:01

Jens Alm


1 Answers

Have you had a look at window.navigator.plugins?

..and the equivalent reference for webkit plugins-

The Apple reference for the WebKit DOM appears to have disappeared. navigator.plugins does work for me in Safari & Chrome. See a jsfiddle here: http://jsfiddle.net/2EaKD/

like image 126
russau Avatar answered Oct 20 '22 00:10

russau