从一个简单的网站访问 firefox 插件的功能
Accessing a firefox addon's functions from a simple website
是否可以在 AddOn 中包含函数库,假设我们有:
notification(str){
$('#notification').text(str);
}
如何从默认 html 网站访问该功能?
谢谢:)
您将需要使用 exportFunction
。
notification(str){
$('#notification').text(str);
}
exportFunction(notification, contentWindow, {
defineAs: "addonNotification"
});
然后从网页中使用window.addonNotification("hello notification!")
更多信息:
是否可以在 AddOn 中包含函数库,假设我们有:
notification(str){
$('#notification').text(str);
}
如何从默认 html 网站访问该功能?
谢谢:)
您将需要使用 exportFunction
。
notification(str){
$('#notification').text(str);
}
exportFunction(notification, contentWindow, {
defineAs: "addonNotification"
});
然后从网页中使用window.addonNotification("hello notification!")
更多信息: