Get window object from tab

前端 未结 2 961
臣服心动
臣服心动 2021-01-14 08:42

I am developing an extension on Firefox\'s Addon SDK (v1.10).

My extension has a toolbarbutton that updates a small badge to its left based on the contents of the ac

2条回答
  •  礼貌的吻别
    2021-01-14 09:02

    Would this be the active window? You can get a window object for the current active window using

    windows.browserWindows.activeWindow
    

    Docs: https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/windows.html#browserWindows

    The window object has a list of tabs currently open in it:

    https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/windows.html#tabs

    If you need to find a tab in a window that isn't the current active tab or window, that might be more difficult to determine. Can you provide more detail about what you're actually trying to do?

提交回复
热议问题