Heshan Perera
Heshan Perera

Reputation: 4630

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

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?

Upvotes: 1

Views: 352

Answers (1)

Wladimir Palant
Wladimir Palant

Reputation: 57651

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

Upvotes: 2

Related Questions