在Chrome扩展程序和Firefox插件中收听页面保存事件 [英] Listen to page save event in a Chrome extension and Firefox addon
问题描述
我正在开发一个插件,当网页保存时需要通知。我一直在浏览铬扩展API很长一段时间,似乎无法找到一个解决方案。
这样的事件是否存在,是否有可能听如果没有,这是可能的火狐插件?
我不认为这是可能的Chrome附加组件。至于Firefox - 当然有一个 < command> $ c在$浏览器窗口(
browser.xul
)中使用ID Browser:SavePage
在其中一个包含文件。你可以在这个元素上为命令
事件添加一个监听器,例如:
document.getElementById('Browser:SavePage')。addEventListener('command',function(e){
console.log('doing command','id:',e.target.id,'e :',e);
},false);
I am in the process of developing a plug-in which needs to be notified when a web page is saved. I have been browsing the chrome extension API for a long time now and cannot seem to find a solution to this.
Does such an event exist and is it possible to listen to it?
If not, is this possible with Firefox addons?
I don't think that it is possible with Chrome add-ons. As to Firefox - sure, there is a <command>
element with ID Browser:SavePage
in the main browser window (browser.xul
), defined in one of the include files. You could add a listener for the command
event on this element for example:
document.getElementById('Browser:SavePage').addEventListener('command', function(e) {
console.log('doing command', 'id:', e.target.id, 'e:', e);
}, false);
这篇关于在Chrome扩展程序和Firefox插件中收听页面保存事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!