Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Closing last tab restores old tab

  • 9 respostas
  • 1 has this problem
  • 1 view
  • Last reply by mark270

more options

When closing the last tab, instead of closing, Firefox restores a tab from a previous session. This session history can also get queued, so if I have closed Firefox with a tab open on more than one occasion, it will restore that many times. Once closing this restored tab, it does appear to remove it from the old session 'queue'.

When I close the last tab, it should _never_ restore an old tab. I'm fine with an about:blank or something similar (closing the browser is preferred), but of all the actions to restore a session, closing the last tab is wildly unexpected.

When closing the last tab, instead of closing, Firefox restores a tab from a previous session. This session history can also get queued, so if I have closed Firefox with a tab open on more than one occasion, it will restore that many times. Once closing this restored tab, it does appear to remove it from the old session 'queue'. When I close the last tab, it should _never_ restore an old tab. I'm fine with an about:blank or something similar (closing the browser is preferred), but of all the actions to restore a session, closing the last tab is wildly unexpected.

Chosen solution

I notice extensions like these in the troubleshooting information:

8: {name: Tab Unloader for Tree Style Tab, type: extension, version: 6.5, isActive: TRUE, id: {7aa0a466-58f8-427b-8cd2-e94645c4edc2}}
9: {name: Tree Style Tab, type: extension, version: 3.6.5, isActive: TRUE, id: treestyletab@piro.sakura.ne.jp}

Does this still happen if you disable these extensions ?

Start Firefox in Safe Mode to check if one of the extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) or if hardware acceleration or userChrome.css is causing the problem.

  • switch to the DEFAULT theme: "3-bar" menu button or Tools -> Add-ons -> Themes
  • do NOT click the "Refresh Firefox" button on the Safe Mode start window
Ler a resposta no contexto 👍 0

All Replies (9)

more options

Do you have Firefox set to restore your previous session at startup? In that case, what you've described is normal -- the last window you close gets restored in its last state before closure, regardless of how that was triggered.

You can set Firefox to open a new tab in a window when you close the actual last tab. Here's how:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box in the page, type or paste lasttab and pause while the list is filtered

(3) Double-click the browser.tabs.closeWindowWithLastTab preference to switch the value from true to false

With this change, after closing the last real tab, instead of closing a window using the little X on the tab again, or the Ctrl+w keyboard shortcut, you'll use the X on the window itself.

What do you think?

more options

Actually, maybe your Firefox is not working the way I described. Do you want to clear away Firefox's session history files to limit what it can restore? Here's how:

Open your current Firefox settings (AKA Firefox profile) folder using either

  • "3-bar" menu button > "?" Help > Troubleshooting Information
  • (menu bar) Help > Troubleshooting Information
  • type or paste about:support in the address bar and press Enter

In the first table on the page, on the Profile Folder row, click the "Open Folder" button. This should launch a new window listing various files and folders in Windows File Explorer.

Leaving that window open, switch back to Firefox and Exit, either:

  • "3-bar" menu button > Exit
  • (menu bar) File > Exit

Pause while Firefox finishes its cleanup, then:

(1) right-click the sessionstore-backups folder and click Rename and add OLD so it becomes sessionstore-backupsOLD (just in case, rather than deleting it)

(2) right-click the sessionstore.jsonlz4 file if it exists and click Rename and add OLD so it becomes sessionstoreOLD.jsonlz4 (just in case, rather than deleting it)

Start Firefox back up again and test how it behaves. Any improvement?

more options

@jscher2000 That just clears out the queue one time. It still continues to accumulate a 'queue' of sessions. (i.e. open link externally which opens Firefox, close window and repeat). When I open a new link when there is session history, I see the old tab for a second (two tabs, the old session and the new link) then the new tab "covers" it up.

Disabling "Restore previous session" gets rid of everything. I just want the most recent session instead of every session.

mark270 modificouno o

more options

Hmm, I didn't think about external links being involved. So is the situation this:

  • Close last window: Firefox keeps that window marked as open in session history while exiting
  • Launch external link
  • Firefox restores previous session and adds a new tab for the external link -- or when you say "covers up" maybe it opens a separate new window for the external link?
  • Repeat
more options

You can force Firefox to always start with a blank tab or the Home page and if necessary use Restore Previous Session.

You can modify this pref on the about:config page to set the startup page.

  • browser.startup.page
    [0:blank; 1:home page; 2:last visited page; 3:restore previous session]

You can open the about:config page via the location/address bar. You can click the button to "Accept the Risk and Continue".

more options

@jscher2000 When opening an external link while Firefox is closed:

  • Firefox is launched
  • If a previous session existed, a tab is opened for that page
  • A second tab is then opened to load the external linked that triggered Firefox to launch
  • The first tab then closes but is still stored as previous session history
  • At this point there is just the new tab on the external link
  • Closing this tab restores the most recent session in a queue each time it is closed

That last step is the unexpected behavior. I want sessions restored on launching Firefox, not on closing the last tab. I would expect session restoration to be more of a 'new window' hook. It's an additional surprise that more than one session is being stored and that closing a tab appears to be drawing from a "magic" queue. I use the term "magic" because there is no transparency to the queue (now visual information as to how many sessions are queued for restoration nor a quick way to manage them).

mark270 modificouno o

more options

I'm baffled why the first tab closed at the fourth bullet. Opening an external link with restore previous session should add the new tab next to the previous one(s). Nothing should close. Could you review these preferences and see what settings you have:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box in the page, type or paste neww and pause while the list is filtered

(3) Review the following preference values:

(A) browser.link.open_newwindow - for links in Firefox tabs

This is the one that has a checkbox on the Preferences page and determines whether targeted links are allowed to open in a new window or are diverted to a new tab instead; there's no effect on untargeted links:

  • 3 = divert new window to a new tab (default)
  • 2 = allow link to open a new window
  • 1 = force new window into same tab

(B) browser.link.open_newwindow.restriction - for links in Firefox tabs

By default, if a page sets width, height, or toolbars for a popup, Firefox will open it in a "dialog-style" window. To force those into a tab as well, you can change this preference to 0:

  • 0 = apply the setting under (A) to ALL new windows (even script windows with limited features)
  • 2 = apply the setting under (A) to normal windows, but NOT to script windows with features (default)
  • 1 = override the setting under (A) and always use new windows

(C) browser.link.open_newwindow.override.external - for links in other programs

This preference governs those external links that open in Firefox (not directly relevant to your question):

  • -1 = apply the setting under (A) to external links (default)
  • 3 = open external links in a new tab in the last active window
  • 2 = open external links in a new window
  • 1 = open external links in the last active tab replacing the current page

Do you have the default values or something else?

more options

Chosen Solution

I notice extensions like these in the troubleshooting information:

8: {name: Tab Unloader for Tree Style Tab, type: extension, version: 6.5, isActive: TRUE, id: {7aa0a466-58f8-427b-8cd2-e94645c4edc2}}
9: {name: Tree Style Tab, type: extension, version: 3.6.5, isActive: TRUE, id: treestyletab@piro.sakura.ne.jp}

Does this still happen if you disable these extensions ?

Start Firefox in Safe Mode to check if one of the extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) or if hardware acceleration or userChrome.css is causing the problem.

  • switch to the DEFAULT theme: "3-bar" menu button or Tools -> Add-ons -> Themes
  • do NOT click the "Refresh Firefox" button on the Safe Mode start window
more options

@jscher2000, yep all defaults. I think I found the issue. @cor-el Funny you mention that. I remembered a while back I tinkered with Tree Style Tab. So I started disabling extensions. Tab Unloader was the one causing the weird behavior. https://addons.mozilla.org/en-US/firefox/addon/tab-unload-for-tree-style-tab/

Thank you both for your patience in helping me diagnose this issue. Everything finally behaves as expected!