Listen to page save event in a Chrome extension and Firefox addon

安稳与你 提交于 2019-12-11 07:43:15

问题


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?


回答1:


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);


来源:https://stackoverflow.com/questions/7554207/listen-to-page-save-event-in-a-chrome-extension-and-firefox-addon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!