Mozilla's getting a new look. What do you think?


Closes a window and all the tabs inside it, given the window's ID.

Note: If an error occurred (for example, because the window could not be found) then runtime.lastError will be set, and you should check for it in the callback.

  windowId,        // integer
  function() {...} // optional function

This API is also available as in a version that returns a promise.


integer. ID of the window to close.
A function called — with no arguments — when the window has closed.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No 45.0 No 33


When the user clicks a browser action's icon, close the window in which the icon was clicked:

function onRemoved() {
  if (chrome.runtime.lastError) {

chrome.browserAction.onClicked.addListener((tab) => {, onRemoved);


This API is based on Chromium's 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.

Document Tags and Contributors

 Contributors to this page: Makyen, chrisdavidmills, wbamberg
 Last updated by: Makyen,