在Chrome扩展程序和Firefox插件中收听页面保存事件 [英] Listen to page save event in a Chrome extension and Firefox addon

查看:170
本文介绍了在Chrome扩展程序和Firefox插件中收听页面保存事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个插件,当网页保存时需要通知。我一直在浏览铬扩展API很长一段时间,似乎无法找到一个解决方案。



这样的事件是否存在,是否有可能听如果没有,这是可能的火狐插件?

解决方案

我不认为这是可能的Chrome附加组件。至于Firefox - 当然有一个 < command> 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆