Automating Mozilla to create Thumbzilla

I love my job. One of my ideas got the green light a month or so back and I’ve been building it (while juggling other projects) ever since.

It wasn’t a unique idea, but it was one that would compliment our other image-related ad services: Web Thumbnails. Essentially, create a small thumbnail of a rendered website and use that as a visual representation of a link before someone clicks on it.

Something like this:

Ars Technica Ars Technica: The PC enthusiast’s resource
Ars Technica. Power users and the tools they love, without computing religion.
Oh yeah Ars Technica review: The Sims 2. Posted September

arstechnica.com/ – 63k – CachedSimilar pages

(Web result borrowed from Google)

Creating the actual thumbnail is not that impressive of a feat. There are dozens of ways of doing that. The real trick, in my book, is creating an automated method of doing so. No technology is worthwhile, in my opinion, of it doesn’t make some task easier.

With the help of Mozilla and Gtk2::MozEmbed, I build Thumbzilla (okay, the name is cliche and taken, but for an internal project, it works). I almost immediately ran into a pickle of a problem: Javascript. Some of the sites I was attempting to thumbnail did not want to play very well with an automated process. When I logged in to check Thumbzilla’s progress I was greeted with a slew popups, alerts, and confirmation dialogs. Nasty stuff.

Obviously, anything requiring manual intervention is a wrench in the cogworks of my project so I did a little digging. I ultimately found this:

Suppose you’re annoyed by pop-up advertisements and want to prevent all
web pages from opening new browser windows. You can do this by adding the
following line to your Mozilla user preferences file (user.js):

user_pref("capability.policy.default.Window.open", "noAccess");

Throw in a little:

user_pref("capability.policy.default.Window.prompt", "noAccess");
user_pref("capability.policy.default.Window.alert", "noAccess");
user_pref("capability.policy.default.Window.confirm", "noAccess");

and my system is now chugging along quite nicely, with some of the annoyances of Javascript disabled. It will be several weeks minimum before Thumbzilla is publicly unveiled, during which time it will get tested, poked and prodded by various people. Still, I have to say I’m quite proud of how it turned out. I think this kind of visualization could be a useful part of searching the web. Let’s just hope I’m not the only one who thinks so.

1 thought on “Automating Mozilla to create Thumbzilla

Leave a Reply

Your email address will not be published. Required fields are marked *