问题
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