问题描述
我用Firebreath编写了一个插件,并且写了一个msi.
I wrote a plugin in Firebreath, and I have a msi written.
我想编写一个JavaScript函数来触发安装(页面顶部弹出窗口)或会将用户重定向到下载页面.有人可以提供示例或有用的链接吗?
I want to write a JavaScript function that will trigger an installation(a pop up in the top of the page)or will redirect the user to a download page.Can someone provide an example or a helpfull link?
谢谢!
推荐答案
FireBreath有一个示例javascript文件,可用于帮助检测插件:
FireBreath has an example javascript file that can be used to help with plugin detection:
https://github.com/firebreath/FireBreath/blob/master/Installer/js/fb_installer.js
基本上,您使用FireBreath.isPluginInstalled("yourPlugin")
查看插件是否已安装.
basically you use FireBreath.isPluginInstalled("yourPlugin")
to see if the plugin has been installed yet or not.
在确认已安装插件后,可以使用FireBreath.injectPlugin("yourPlugin", divContainer, "pluginId", callback)
将插件添加到页面,如果发现未安装插件并显示MSI的下载链接,则可以使用FireBreath.waitForInstall("yourPlugin", callback)
在插件显示时调用您的回调函数.
You can use FireBreath.injectPlugin("yourPlugin", divContainer, "pluginId", callback)
to add the plugin to the page after you have verified that the plugin is installed, and if you find that the plugin is not installed and display a download link to the MSI you can use FireBreath.waitForInstall("yourPlugin", callback)
to have your callback function called when the plugin shows up.
该脚本可能并不完美,但它应该为您提供一个良好的起点.
The script may not be perfect, but it should give you a good starting point.
这篇关于插件安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!