Manifest

When requested, a $(ref:windows.Window) will contain an array of $(ref:tabs.Tab) objects. You must declare the "tabs" permission in your manifest if you require access to the $(ref:tabs.Tab.url url), $(ref:tabs.Tab.title title), or $(ref:tabs.Tab.favIconUrl favIconUrl) properties of $(ref:tabs.Tab). For example:

{
  "name": "My extension",
  ...
  "permissions": ["tabs"],
  ...
}

The current window

Many functions in the extension system take an optional windowId parameter, which defaults to the current window.

The current window is the window that contains the code that is currently executing. It's important to realize that this can be different from the topmost or focused window.

For example, say an extension creates a few tabs or windows from a single HTML file, and that the HTML file contains a call to $(ref:tabs.query). The current window is the window that contains the page that made the call, no matter what the topmost window is.

In the case of the event page, the value of the current window falls back to the last active window. Under some circumstances, there may be no current window for background pages.

Examples

Two windows, each with one tab
You can find simple examples of using the windows module in the examples/api/windows directory. Another example is in the tabs_api.html file of the inspector example. For other examples and for help in viewing the source code, see Samples.