--- title: windows slug: Mozilla/Add-ons/WebExtensions/API/windows translation_of: Mozilla/Add-ons/WebExtensions/API/windows ---
{{AddonSidebar}}

Взаимодействие с окнами браузера. Вы можете использовать этот API, чтобы получить информацию об открытых окнах, а также открывать, изменять и закрывать окна. Вы также можете обрабатывать события открытия, закрытия окна, и активировать события.

Types

{{WebExtAPIRef("windows.WindowType")}}
Тип окна браузера.
{{WebExtAPIRef("windows.WindowState")}}
Состояние окна браузера.
{{WebExtAPIRef("windows.Window")}}
Информация об окне браузера.
{{WebExtAPIRef("windows.CreateType")}}
Specifies the type of browser window to create.

Properties

{{WebExtAPIRef("windows.WINDOW_ID_NONE")}}
The windowId value that represents the absence of a browser window.
{{WebExtAPIRef("windows.WINDOW_ID_CURRENT")}}
The windowId value that represents the current window.

Functions

{{WebExtAPIRef("windows.get()")}}
Gets details about a window, given its ID.
{{WebExtAPIRef("windows.getCurrent()")}}
Gets the current window.
{{WebExtAPIRef("windows.getLastFocused()")}}
Gets the window that was most recently focused — typically the window 'on top'.
{{WebExtAPIRef("windows.getAll()")}}
Gets all windows.
{{WebExtAPIRef("windows.create()")}}

Creates a new window.

{{WebExtAPIRef("windows.update()")}}
Updates the properties of a window. Use this to move, resize, and (un)focus a window, etc.
{{WebExtAPIRef("windows.remove()")}}
Closes a window, and all its tabs.

Events

{{WebExtAPIRef("windows.onCreated")}}
Fired when a window is created.
{{WebExtAPIRef("windows.onRemoved")}}
Fired when a window is closed.
{{WebExtAPIRef("windows.onFocusChanged")}}
Fired when the currently focused window changes.

Browser compatibility

{{Compat("webextensions.api.windows")}}

{{WebExtExamples("h2")}}

Acknowledgements

This API is based on Chromium's chrome.windows API. This documentation is derived from windows.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.