【问题标题】:Firefox extension localStorage eventsFirefox 扩展 localStorage 事件
【发布时间】:2011-01-18 10:47:58
【问题描述】:

我正在制作一个 Firefox 扩展以确定何时从 localStorage 触发“存储”事件。

在 Firefox 3 中,我有这一行将窗口中的存储事件绑定到扩展中的函数。

$(doc, doc).bind('storage', on_store());

这在 Firefox 3 中有效。但是,在 Firefox 4 中尝试时似乎没有收到事件。

【问题讨论】:

  • 您是否尝试过使用像 addEventListener 这样的非 JQuery 方法,只是想看看 Firefox 4 是否改变了一些东西,使得在扩展中使用 JQuery 变得更加困难?
  • 为什么是on_store() 而不是on_storeon_store() 是否返回函数?

标签: javascript jquery firefox-addon local-storage firefox4


【解决方案1】:

The spec 似乎暗示storage 事件将在窗口上触发(所以$(window).bind('storage', on_store) 是绑定它的正确方法)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-18
    相关资源
    最近更新 更多