We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE



Removes a closed window from the browser's list of recently closed windows.
Note that the sites visited by that window are not removed from the browser's history. Use the browsingData or history APIs to remove history.

This is an asynchronous function that returns a Promise.


var forgettingWindow = browser.sessions.forgetClosedWindow(
  sessionId            // string


String. The ID of the session you want to forget.

Return value

A Promise. This will be fulfilled with no arguments when the session has been removed.

If an error occurs, the promise will be rejected with an error message.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic support No No55 No No


This code forgets the single most recently-closed session, whether it's a tab or a window:

function forgetMostRecent(sessionInfos) {
  if (!sessionInfos.length) {
    console.log("No sessions found")
  let sessionInfo = sessionInfos[0];
  if (sessionInfo.tab) {
    browser.sessions.forgetClosedTab(sessionInfo.tab.windowId, sessionInfo.tab.sessionId);
  } else {

function onError(error) {

browser.sessions.getRecentlyClosed({maxResults: 1})
.then(forgetMostRecent, onError);

Document Tags and Contributors

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