检测程序是否是从 javascript 安装的
我正在为 Firefox 开发一个附加组件或插件(NPAPI)。
从扩展的 JavaScript 或 NPAPI 插件中检测是否安装了某个 Windows 程序的最佳方法是什么?
多谢!
注意:附加组件(插件)将由 NSIS 安装程序与 Windows 程序一起安装。有没有办法让 Firefox-Addon(或 NPAPI 插件)与应用程序进行通信,如果没有得到响应,则意味着该程序尚未安装?!
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 ?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不清楚你是在编写扩展还是插件。如果您正在编写扩展,则可以使用 nsIWindowsRegKey 界面来查找注册表项(例如卸载程序)与应用程序关联。如果您正在编写一个插件,那么它显然可以直接访问注册表,但尽管我知道这是可能的,但我不知道如何实现可从网页调用的插件的可编写脚本的接口。
实际上,重新阅读这个问题,如果您的应用程序提供了一个插件,并在 Firefox 中注册了它,那么网页可以检测到该插件(以及应用程序)已安装并启用,因为它将出现在 navigator.plugins 数组。 (如果已安装但未启用,则创建插件将提示用户启用它,但如果未安装,则创建插件将提示用户下载它,这没什么帮助。)
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.)