Over the last 1.5-2 years, I collected 700+ tabs in my Firefox :) Maybe this summer I will have some time to sort them out. However, today when I switched my computer on, all my tabs were gone and I got a clean Firefox instance with one tab only. Hmm… I had a similar problem once and then I installed an add-on called “Session Manager”. In this add-on I made the setting to offer the list of previous sessions upon restart but it didn’t do anything! Damn, how to get back my tab collection?
.mozilla directory there is a file called
sessionstore.js that stores — among others — the opened tabs. However, this file was very small, my previous tabs were clearly not in it. Thank God there was a backup copy of this file next to it called
sessionstore.bak. It was a big file and the timestamp of the file indicated that it was created 2 days ago when everything was OK with my tabs.
So, how to extract the old tabs from
This is a JSON file, but it’s not pretty printed. I suggest copying this file to somewhere else where you can experiment with it. First, let’s make it readable:
$ python -m json.tool sessionstore.bak > session.json
Now you can open
session.json with a text editor. You will find lines with a “
url” key, but the number of these rows is huge. I had 731 tabs (that I lost) but this file contained 6500+ URLs. As I noticed, it also contains the URLs of closed tabs. How to extract the URLs of the opened tabs only?
Again, Python came to my rescue. After analyzing the structure of this JSON file, I could extract the tab URLs the following way:
$ python # version 2.7 >>> import json >>> f = open('session.json') # input file >>> g = open('tabs.txt', 'w') # output file >>> d = json.load(f) >>> tabs = d["windows"]["tabs"] >>> cnt = 0 >>> for t in tabs: ... print >>g, t["entries"]["url"] ... cnt += 1 >>> cnt 731 # Yeah! All of them are here! >>> g.close() >>> f.close()
The URLs of the lost tabs are now in the
I didn’t make a script of it but feel free to do it. From now on I will make regular backups of my opened tabs with the URL Lister add-on.
Read this: The Best Browser Extensions that Protect Your Privacy @lifehacker.
I installed the following extensions:
A long time ago I also made a Greasemonkey script called BH IMDB/Word Highlight. This script is written for some specific sites in Hungary. However, you can take ideas from this how to highlight a text on a web site.
You have downloaded a Greasemonkey script but… how to install it?
Here I suppose you have the Greasemonkey add-on installed (Hey, what is GM?). Well, I didn’t find anywhere the option “install from local file“. A GM script is called
*.user.js and if you open the URL (
http://...) of such a script, GM will recognize it and offer to install it (for this GM must be enabled). However! If you open your script locally (
file://...), nothing happens. WTF?
Calm down. You know Python, right? The Swiss army knife of programmers. Just navigate to the directory where the GM script is located and start a web server:
$ python -m SimpleHTTPServer
Now open the URL http://localhost:8000 , click on the user script and GM will offer to install it. Python, what would I do without you?
User scripts are installed in this directory: “
~/.mozilla/firefox/xxxxxxxx.default/gm_scripts“. Here you will find a
config.xml file too that is created by GM.
I installed this way this script: Greasemonkey: focus first input field. This script puts the focus on the first input field. I use it with Amazon and IMDB and works like a charm.