Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / Misc / How to Restore Previous Session (Tabs) in Firefox

December 17, 2014 Misc

How to Restore Previous Session (Tabs) in Firefox

In this article we’ll consider how to restore the previous session with open tabs in Mozilla Firefox. The problem of loosing all tabs as a result of Mozilla Firefox crash (due to different reasons: from power outages to running out of available memory and system hang) occurs quite often.

The mechanism of automatic Session Restore appeared in the second version of the browser already.  Firefox saves all open windows and tabs, including urls of pages, the size and position of a window/tab and information entered into the text fields, into a special file (sessionstore.js). When the session has been completed incorrectly, Firefox tries to automatically restore the previous session based on the data in this file with all windows and tabs that had been opened before the browser failed. If the browser fails in the second time, the window with the following message appears after you start Firefox for the next time:


Well, this is embarrassing.

Firefox is having trouble recovering your windows and tabs. This is usually caused by a recently opened web page.

You can try:

  • Removing one or more tabs that you think may be causing the problem
  • Starting an entirely new browsing session

Restore the Previous Session (Tabs) in Firefox

Firefox can restore all windows and tabs open at the last exit or unexpected failure of Firefox. If you check the tabs opened earlier that have to be restored and click “Restore” button, Firefox opens these web-pages.

If the Session Restore window doesn’t appear automatically, you can try to call it by clicking History -> Restore Previous Session.

Note. This window can also be called by entering about:sessionrestore in the address bar of the browser.

Mozilla Firefox - Restore Previous Session

If Restore Previous Session menu is not active (as in the snapshot), something has gone wrong and you’ll have to use advanced means to restore the tabs.

Firstly, let’s talk about the backup mechanism of open tabs and windows in Firefox. Firefox saves the information about the current session in sessionstore.js, which is located in the user profile folder (C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\xxx.default – in Windows 7 and 8, or c:\Documents and Settings\username\Application Data\Mozilla\Firefox\xxx.default in XP). If you track how its size is changed in process of working in Firefox, you can notice that when opening a new tab/window its size grows, and when closing a tab/window, it reduces.

After its failure, Firefox automatically tries to load the information about open tabs and windows from sessionstore.js. If this file is damaged, unavailable, has wrong format or browser doesn’t see it on some reason, Firefox starts a new clean session, and Restore Previous Session menu becomes inactive. However, there is no reason to give up — there are some other ways to restore the list of previously opened tabs.

The matter is that sessionstore.bak that contains information about the previous Firefox session is stored in the same profile directory. This file is a copy of sessionstore.js, which is automatically created if Firefox has failed in the previous time.

Important. Before going to the manual method of recovery, back up your files sessionstore.js and sessionstore.bak by copying them to any directory.

Close Firefox and rename sessionstore.bak into sessionstore.js (with replacement), then try to run Firefox again. Look, if the previous session restore has been successful.

Tip. This directory also can find sessionstore-1.js, sessionstore-2.js, etc.. These are the earlier copies of open sessions. Look at the date when these files have been created. If the session recovery on this date suits you, try to rename sessionstore-1.js into sessionstore.js and run Firefox.

If this means hasn’t helped, you can try to get a URL list from sessionstore.js files. The file format is quite specific. You can analyze file contents manually and find all open pages that are contained in the constructions starting from “url”:”http, but it’s quite hard and time consuming.

sessionstore.js file format

Let’s try to automate extraction of urls from this file:

  • First of all, you need to install Firefox extension for developers Firebug (Firefox -> Add-ons – > Get Add-ons -> Firebug – > Install).
  • Then find the previously copied file sessionstore.js and rename it into sessionstore.txt.
  • Open this file in the browser (Firefox->New tab ->Open file, specify the path to the txt file).
  • Run Firebug console (Firefox->Web Development->Firebug-> Open Firebug)
  • In the bottom of the window there is a console prompt (it is marked with the red rectangle on the screenshot). Copy the next js-code into it: javascript:(function(){var D=document,H,i=j=0,P=D.getElementsByTagName('PRE'),t='',R=/[^:]\{"entries":\[\{("url":"([^"]*)")\,("title":"([^"]*)"){0,1}/g,T,U;for(j=0;E=P[j];j++){H=E.innerHTML;while(R.exec(H)){U=RegExp.$2;T=RegExp.$4;if(T.length==0){T=U;}t+='<b>['+(++i)+']</b> <a href='+U+'>'+T+' ('+U+')<\/a><br>';}}with(window.open().document){write(t);close()}})(); And press Enter.Firebug console prompt
  • After that a new tab appears that contains all the links the script has been able to extract from the session restore file.
  • Open the links you need.

3 comments
0
Facebook Twitter Google + Pinterest
previous post
How to Repair the Component Store in Windows 8
next post
Windows 8 / 2012 Fix: “Failure configuring Windows updates. Reverting changes”

Related Reading

IPMI: Configuring SuperMicro Remote Management Interface

March 10, 2020

How to Recover Deleted Files from a TRIM-Enabled...

November 14, 2019

Microsoft KMS Volume Activation FAQ

September 6, 2019

How to Check .Net Framework Version?

October 26, 2018

Configuring Kerberos Authentication in Different Browsers

August 1, 2018

3 comments

John August 30, 2015 - 11:23 pm

How many previous sessions are stored?  Can I go back to older than previous sessions?
I closed Firefox with many tabs, did a virus scan, and after completing it, the program popped up a Firefox window with an ad.  Now that’s the previous session!  In trying to remedy that, the session I want is now several sessions back.
 
Thanks,

Reply
Cornel Mihalache May 16, 2016 - 4:00 pm

Hi,
My story was this: in “about:preferences” checked “Show my windows and tabs from last time”. 90 tabs is opening every time I open Mozilla. Last time I close my browser not seeing an advertising  window opened. In time moment I felt the ceiling falling on my head… Tryied many times to restore and NOTHING! The solution is below:
My Restore Previous Session remains grey (inactive)… I have to mention I already replaced sessionstore.js with my previous back-up. A genius idea was (in a totally desperate case) to click on “Restore All Windows” (History->Recently Closed Windows->Restore All Windows).
Don’t forget to have “Show my windows and tabs from last active” option active when close your browser after that.

Reply
Jake May 6, 2019 - 1:14 am

Let me just say that I love you for this comment. I had a ton of important tabs open on Firefox and another window with one tab. I closed the first window with multiple tabs, hoping to restore the session later, while keeping the other window (with one tab) open. Then I opened a new Firefox window and the Restore Previous Session was greyed out. Thankfully I found your comment which said one should go to History > Recently Closed Windows > Restore All Windows . Through that I was able to restore my previous session in the other window.

I cannot tell you how grateful I am to you for this! Thank you forever <3

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • Accessing USB Flash Drive from VMWare ESXi

    February 26, 2021
  • How to Sign a PowerShell Script (PS1) with a Code Signing Certificate?

    February 25, 2021
  • Change the Default Port Number (TCP/1433) for a MS SQL Server Instance

    February 24, 2021
  • How to Shadow (Remote Control) a User’s RDP session on RDS Windows Server 2016/2019?

    February 22, 2021
  • Configuring PowerShell Script Execution Policy

    February 18, 2021
  • Configuring Proxy Settings on Windows Using Group Policy Preferences

    February 17, 2021
  • Updating Group Policy Settings on Windows Domain Computers

    February 16, 2021
  • Managing Administrative Shares (Admin$, IPC$, C$, D$) in Windows 10

    February 11, 2021
  • Packet Monitor (PktMon) – Built-in Packet Sniffer in Windows 10

    February 10, 2021
  • Fixing “Winload.efi is Missing or Contains Errors” in Windows 10

    February 5, 2021

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top