Restoring App Tabs in Firefox

A simple solution to restoring App Tabs with the Firefox session store

Solution to disappearing App Tabs in Firefox

If you use App Tabs in Firefox you’ll know how frustrating it is when you get to your PC in the morning, open up the browser and find they have all disappeared. This is due to a badly thought-out bit of programming and there doesn’t seem to be a direct solution. That’s why I have created my own little bit of code to fix it.

Firefox App Tabs and the Session Store

The problem is that Firefox app tabs are stored in the session data. Session data is a system file which records a snapshot of which tabs you have open when Firefox is closed. The upshot of this is that if you open another Firefox window – or if a webpage opens a popup window without you knowing it – and if that window is the last one you close, then Firefox will see that there are no tabs open in that Window and overwrite your old session data with the programmatic equivalent of ‘no tabs open’.

I have webmail, calendar, CRM and social media tabs open as App Tabs in Firefox and don’t want to have to recreate those each time Firefox gets confused. So I devised a simple solution:

How to backup and restore Firefox App Tabs

First, create your backup. You will need to repeat this any time you want to change your Firefox App Tabs.

  1. Close all Firefox windows except the one with your App tabs
  2. In Firefox open your App tabs and make sure each is on the page you want to start at each time.
  3. Close Firefox
  4. Go to the directory where your Firefox session store is located. ThisĀ article tells you how to locate it
  5. Find the file called sessionstore.js
  6. Make a copy of the file (using regular copy and paste)
  7. Rename the file to something meaningful. I call it sessionstore-with-tabs.js

Now, anytime you need to restore your Firefox App tabs you can copy the good session store over the new one:

  1. Make sure all Firefox windows are closed
  2. Go to the directory where the Firefox session store is located (see step 4, above)
  3. Delete sessionstore.js
  4. Make a copy of sessionstore-with-tabs.js (or whatever you chose to call your backup) and rename it to sessionstore.js

When you open Firefox you will now find that your app tabs are all exactly as you saved them.

Using a batch file to automate restoring Firefox App Tabs

If those four steps sound like more trouble than just typing in the URLs and recreating the app tabs by hand, then you’re going to be pleased to hear that it can be automated.

If you’re not familiar with batch files then you may want to do some background reading before trying this. Not that it’s risky, just that I don’t want to be providing support if you don’t understand what you’re doing!

The goal here is to have an option on the start menu which restores all the Firefox App Tabs in an instant. The way to do this is to create a batch file which does the copying and renaming, and create a shortcut to that on the start menu.

  1. Find a suitable directory for storing the batch file. I use ‘my documentsbatch files’
  2. Get the full path to the directory with sessionstore.js
  3. Create a batch file with this line in it:copy “C:UsersPhilipAppDataRoamingMozillaFirefoxProfilesl6n8dhff.defaultsessionstore-with-tabs.js” “C:UsersPhilipAppDataRoamingMozillaFirefoxProfilesl6n8dhff.defaultsessionstore.js”

    You will need to replace the bits in red with your file path from step 2.

  4. Go to the directory where you stored the batch file and create a shortcut (right-click on the file and look for the option)
  5. If you wish, you can edit the properties of the shortcut to change its name (eg. ‘Restore Firefox Tabs’) and its icon
  6. Using your mouse, drag the shortcut to the Start Menu and pin it in the position where you want it.

In conclusion

This approach has worked well for me – hope you benefit from it too. If so, please leave a comment!

If you want to, you could also create a batch file that backs-up the session file – useful if you change it often. It might also be smart to put some code into the batch file that prompts you to close Firefox before continuing – or maybe even checks that Firefox isn’t already running. But that’s certainly beyond the scope of this post!


This entry was posted in Technical stuff. Bookmark the permalink. Both comments and trackbacks are currently closed.