扩展中要包含插件plugin,如何写扩展

阅读:2383回复:1
2011-07-30 19:14
写私信
楼主#
html中用embed 就引用了插件,

我想在所有的页面中都用到插件,所以写了个扩展,

在扩展中弄个plugin文件夹,并把插件放进去,但是在页面中要用到这个插件还需要在扩展里写代码,是不是? 是在xul里写,还是该怎么弄?

求高人指点,谢谢
2011-07-30 19:14
写私信
1楼#
在扩展里面 overlay.xul 中第一一个 <label control="navigator-toolbox" />
然后在JS 里面插入plugin.
var mimeTYpe = "application/toshiba-fpu_browser_addin";
var clsPlugin;
var pluginID="pluginIdTFPU";
var XMLNS="http://www.w3.org/1999/xhtml";

var item = document.createElementNS(XMLNS, "html:embed"); // create a new XUL menuitem
item.setAttribute("type", mimeTYpe);
item.setAttribute("id", pluginID);
item.setAttribute("with", "0");
item.setAttribute("height", "0");
var element = document.getElementById("navigator-toolbox");
element.appendChild(item);
clsPlugin = document.getElementById(pluginID);
clsPlugin 就是一个实例
可以用他调用接口
就可以实现 extension 加载plugin, 我想这样你就可以 主动调用了。