我制作了一个简单的html页面,其中包含npruntime插件,它在本地运行得很好。当然,npruntime对象文件(npmyapp.dll)已经注册,所以浏览器可以加载插件。
(加载插件代码类似于..)
<embed type="application/x-mytestapp" width="400" height="200">我想知道的是,如果浏览器找不到插件,如何要求安装。
例如,当我们在安装flash player之前浏览包含flash player的网站时,浏览器要求安装。多么?
任何帮助都将不胜感激。谢谢!
发布于 2012-01-26 00:18:06
不能百分之百确定是否可以使用embed标记(embed标记多年来一直存在一些奇怪的问题;我避免使用它们,而是使用object标记),但您可以将代码放在object标记中,只有在找不到您的插件时才会出现。
<object type="application/x-mytestapp" width="400" height="200">
<a href="http://mytestapp.com/plugin/plugin_installer.msi">You are missing a plugin; click here to download it</a>
</object>也就是说,我首选的安装方法是使用javascript来检测它是否已安装,您可以通过查看navigator.plugins并枚举和检查mimetype或按名称查找它来完成此操作。
FireBreath有一个示例javascript检测器/注入器来演示这一点:https://github.com/firebreath/FireBreath/blob/master/Installer/js/fb_installer.js
https://stackoverflow.com/questions/8998760
复制相似问题