Restore Session odd behavior in Windows 11
I found a really unusual behavior.
If I close Firefox using the "x" at the top right of the window, the Windows default for close, it does not restore session no matter what I do. I can manually go to the settings, history, recently closed windows, and restore them from there, of course - but that is a definitive hassle.
Strangely, even if I open up a new tab less than 2 seconds before I hit the X to close, it will not restore the session but does indeed save the new tab to the previous.jsonlz4 file, and makes that available via going through the settings menu.
What is oddly more unusual is that if I close Firefox by way of ctrl-shift-q, it works fine (opening Firefox after ctrl-shift-q restores the session without any extra intervention required).
How do I make Firefox recognize closing via the bog-standard-since-windows-3.11-for-workgroups X in the top right of the window as properly closing/quitting?
Penyelesaian terpilih
Hmm, your Firefox is not behaving normally.
On Windows, Firefox quits when you click the X button on the last window AND if Firefox is set to restore your session automatically, then that single window is restored.
It sounds like your Firefox is automatically restoring your previous session -- otherwise, you would need to select Restore Previous Session first before you find old windows listed under Recently Closed Windows -- but for some reason the window you closed last isn't being treated as an open window; instead it is being treated as a closed window.
Why???
Is there any possibility that another window is closing after the one you think is the last window?
Baca jawapan ini dalam konteks 👍 1All Replies (7)
Penyelesaian Terpilih
Hmm, your Firefox is not behaving normally.
On Windows, Firefox quits when you click the X button on the last window AND if Firefox is set to restore your session automatically, then that single window is restored.
It sounds like your Firefox is automatically restoring your previous session -- otherwise, you would need to select Restore Previous Session first before you find old windows listed under Recently Closed Windows -- but for some reason the window you closed last isn't being treated as an open window; instead it is being treated as a closed window.
Why???
Is there any possibility that another window is closing after the one you think is the last window?
In Firefox this works differently as Firefox can have more than one window open. If you use the close X then you only close this window. If Firefox notices that you closed the last window then the shutdown sequence is started (quit-application). This also means that only the last window you close is restored automatically and you can restore three more windows via "History -> Recently Closed Windows/Tabs". If there are other windows open apart from browser windows then it might even be more complicated and yo7u may have to use "Restore Previous Session".
Best is always to use one of these to close Firefox if you are currently doing that by clicking the close X on the Firefox Title bar, especially if you have multiple windows open to prevent losing tabs in unnoticed windows.
- "3-bar" menu button -> Exit (Power button)
- Windows: File -> Exit
- Mac: Firefox -> Quit Firefox
- Linux: File -> Quit
I verified multiple times that I only had one Firefox window open when testing this. (see note later)
Firefox DOES automatically restore my last session if (and only if) I use ctrl-shift-q or "3-bar" menu -> Exit. If I use the simple X, it does NOT automatically restore my last session (which is the odd behavior).
I do not have multiple Firefox windows open (just the one), even when I first boot and Firefox is Literally the ONLY program running (that isn't windows services), but if I close via the X it almost acts like I opened a new window with a single tab, closed the first window, then closed the 'new tab' window.
.....
-facedesk-
A fellow user of my computer had opened up a session of Firefox in a SECOND DESKTOP. This feature of Windows 11 (and 10) is rather amazing, allowing you to do a myriad of things in visually isolated environments that you can switch between via ctrl-windows-arrow (left and right).
The downside is if you normally just alt-tab, you won't see windows in the other desktop. If you hold the windows key & tab, however, you'll see the others.
Sure enough, there was, indeed, a new tab only window of Firefox open on the second desktop, and this was the 'last' window open when I hit the X.
In the screenshot below, you can see the "bar" across the bottom that shows up when I held the windows key & pressed tab once. Thank you for helping me find my idiocy resolution. :D
Diubah
I just wanted to add my 2cents to this post as I just stumbled upon it.
A few months ago Firefox stopped restoring my sessions as well. After many hours of trying to debug, I had given up and resorted to manually restoring them using a third-party tab manager, which I was already using.
Exactly as described above, if I quit the app using the menus it restored fine. If I clicked the close "X" button, it wouldn't restore. It turns out, somehow an empty Firefox Window had been opened on a 2nd virtual desktop as well. I don't know how, why or when, but there it was. I discovered it only because of the original post by verahsa (thank you).
This obviously meant that I was never actually quitting Firefox when I clicked the "X" button. When I clicked the icon to launch Firefox again, I was really just getting a new window. If Windows was restarted and I relaunched Firefox, I'd get two empty windows without realizing it (the new one from launching, and the restored one on the virtual desktop).
Given how easy it is to inadvertently cause this issue, I think it's definitely something that needs looking into.
I'm not sure what the fix is, but my first reaction is: Why didn't Firefox bring the restored window on the 2nd virtual desktop to focus instead of restoring it and then opening a second new window when I launched after a restart?
Thanks again @verahsa for the post.
smallroad said
I'm not sure what the fix is, but my first reaction is: Why didn't Firefox bring the restored window on the 2nd virtual desktop to focus instead of restoring it and then opening a second new window when I launched after a restart?
The desktop shortcut always seems to launch a new window. If it launched a new tab in the last-used existing window instead, that might be puzzling, but would at least be a clue that there was a window open. I think you would need to modify your shortcut to do that. On Windows, you'd do this:
- right-click > Properties
- on the Shortcut tab, edit the "Target" line by adding a space and then -new-tab about:home
For example:
"C:\Program Files\Mozilla Firefox\firefox.exe" -new-tab about:home
(If you prefer a blank page, you can use about:blank instead of about:home. Or any URL.)
Not using a desktop shortcut personally. Using a pinned taskbar icon which doesn't normally start a new window if Firefox is open. Rather, it shows any open windows.
However, if the only open window is on a different virtual desktop, tapping the taskbar icon opens a new window as if Firefox is not running.
Part of the issue here probably lies in Microsoft's implementation of virtual desktops. For comparison -- with Mac OS X, if I have a Window open on another virtual desktop, tapping the Firefox icon cause a focus shift and the operating system is smart enough to switch to that virtual desktop instead of opening a new window.
Surprisingly, I just had this happen again!
Went through a normal, automated Firefox update (112.0.1). When Firefox restarted, it opened a window on my second virtual desktop and a blank one on the main desktop. I only noticed because my session was not restored again and I checked the other desktop immediately. The window on the second desktop was not my previous session either.
It would appear that when I experienced this before, it wasn't due to my user error as I had originally thought. It will be interesting to see if it reverts again on the next update...
Edit: The issue did not occur on the next update, but will pay attention moving forward.
Diubah