javascript 有没有办法在 Firefox 扩展中更改 cookie 时监听事件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4132561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to listen to event when a cookie is changed in a Firefox Extension
提问by ivanceras
I am trying to build a firefox extension which listens to events when a cookie is changed by any domain from any page and handle it accordingly. Is there an easy way to do this in javascript?
我正在尝试构建一个 Firefox 扩展,它在任何页面的任何域更改 cookie 时侦听事件并相应地处理它。有没有一种简单的方法可以在 javascript 中做到这一点?
回答by sdwilsh
You can listen to the cookie-changedtopic with the observer service.
您可以使用观察者服务收听cookie 更改的主题。
回答by Hitesh Joshi
http://jsfiddle.net/ArondeParon/5RsTm/4/
http://jsfiddle.net/ArondeParon/5RsTm/4/
try changing the cookie, it will pop up an alert.
尝试更改cookie,它会弹出一个警报。

