Archive

Archive for the ‘firefox’ Category

Firefox 29: where is the Tools menu?

Problem
User interface has changed drastically in Firefox 29. Where is the File, Edit, View, … Tools, Help menu?

Solution
That menu is hidden by default. You can access it by pressing Alt-T.

Categories: firefox Tags: ,

Firefox: restore your lost tabs

April 30, 2014 Leave a comment

Problem
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?

Solution
In the .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 sessionstore.bak?

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"][0]["tabs"]
>>> cnt = 0
>>> for t in tabs:
...     print >>g, t["entries"][0]["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 tabs.txt file.

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.

Categories: firefox, python Tags: , , , ,

Remove global menu bar from Firefox (22.0+)

January 17, 2014 Leave a comment

Problem
You managed to disable the stupid global menu in your Ubuntu but Firefox still has this shit. How to get rid of it?

Solution
Type in about:config and change the value of the line ui.use_unity_menubar to false.

Tip from here.

Categories: firefox, ubuntu Tags: ,

Online Security

June 29, 2013 Leave a comment

Read this: The Best Browser Extensions that Protect Your Privacy @lifehacker.

I installed the following extensions:

Categories: firefox, security Tags: ,

GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0′ failed

Problem
Firefox 21.0 on Ubuntu 13.04 drops this error message in the command line: “GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed". Whenever I want to open a URL from a script, I get this, which is quite annoying. Actually, this is a known bug.

I use Python a lot and when I call "webbrowser.open_new_tab(url)", I also get this error message.

Workaround
Until it gets resolved, I call firefox directly and redirect the stderr to /dev/null:

firefox -url www.google.com 2>/dev/null

In Python:

def open_url(url):
    #webbrowser.open_new_tab(url)
    os.system('firefox -url "{url}" 2>/dev/null'.format(url=url))

BH IMDB/Word Highlight

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.

Install a Greasemonkey script from a local file

Problem
You have downloaded a Greasemonkey script but… how to install it?

Solution
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.

Example
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.

Become a Reddit power user

Goal
You want to become a Reddit power user.

Tip
Install the Reddit Enhancement Suite Firefox add-on. The result will be a Reddit on steroids :)

Links

Categories: firefox Tags: , ,

MozRepl is broken in Firefox 20 but there is a patch

April 19, 2013 Leave a comment

I use the MozRepl Firefox add-on a lot but it stopped working with Firefox 20. But there is an updated version available. More info with the patch here.

Categories: firefox Tags: , ,

Install Adobe Flash for Firefox properly

April 14, 2013 Leave a comment

Let’s see how to install Adobe Flash under Ubuntu for Firefox properly.

Visit the official site (http://get.adobe.com/flashplayer/) and download the .tar.gz file. Create a temporary directory (e.g. /tmp/flash) and save the file there. This archive is a tarbomb, that's why we put it in a dedicated folder.

Unzip the archive. There is a "usr" subfolder whose owner and group must be set before copying it to "/usr". Switch to root (with "su") and perform the following actions:

  1. chown -R root:root usr (where "usr" is the subfolder from the archive, not the system folder)
  2. copy this "usr" folder to "/usr", i.e. copy it to the system folder

(Of course, you can also do these steps with "sudo" too.)

Finally, copy the file "libflashplayer.so" to the directory "$HOME/.mozilla/plugins/". It's very likely that this folder doesn't exist yet so create it first.

Restart Firefox and enjoy the ultimate Flash experience :)

Categories: firefox, ubuntu Tags: ,
Follow

Get every new post delivered to your Inbox.

Join 70 other followers