开发者

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

开发者 https://www.devze.com 2023-04-08 06:51 出处:网络
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开发

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开发者_Python百科 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);
0

精彩评论

暂无评论...
验证码 换一张
取 消