Search code examples
javascriptfirefox-addongoogle-chrome-extensionbhosafari-extension

Detect if Program is installed from javascript


I'm developing an add-on or a plugin (NPAPI) for firefox.

What are the best methods to detect if a certain windows program is installed or not from within the JavaScript of the extension or from within the NPAPI Plugin?

Thanks a lot!

NOTE: The add-on(plugin)will be installed by a NSIS installer along with the windows program. Is there a way to make the Firefox-Addon(or NPAPI plugin) communicate with the application in so if it doesn't get a response this means the program is not installed ?!


Solution

  • I'm not clear as to whether you're writing an extension or a plugin. If you're writing an extension, you can use the nsIWindowsRegKey interface to look for registry entries (e.g. uninstaller) associated with the application. If you're writing a plugin, then it can obviously access the registry directly, but although I know it's possible I don't know how to implement a scriptable interface for the plugin to be called from a web page.

    Actually, re-reading the question, if your application provides a plugin, and registers it with Firefox, then the web page can detect that the plugin (and therefore the application) is installed and enabled because it will appear in the navigator.plugins array. (If it is installed but not enabled then creating the plugin will prompt the user to enable it, but if it is not installed then creating the plugin will prompt the user to download it, which is less helpful.)