Sponsored By

Review: Greasemonkey Serves Up The Web As You Like It

The hot new Greasemonkey plug-in for Firefox takes browser customization to a whole new level by letting users filter site content or change page behaviors in ways that make themes and tabbed browsing seem almost quaint by comparison.

9 Min Read

The glory of open-source software is that it allows anyone with the inclination and the scripting knowledge to get under the hood and hot-rod their computing environment. But most of the time, that advantage is available only to people with the programming skills to make the changes they want. That's where Greasemonkey, a free plug-in for Firefox, comes in -- it simplifies hacking the browser.

Released at the end 2004, Greasemonkey is the latest in a growing arsenal of Firefox customization tools. It changes how Web pages look and act by altering the rendering process. Greasemonkey is to Firefox what aftermarket parts are to cars -- it lets you personalize your browser by making it faster and more powerful or simply by making browsing more aesthetically pleasing. How and why you will use Greasemonkey (and I predict you will, if you don't already) will depend on how you browse now.

Pimp Your Ride
So what does Greasemonkey do? It is simply a means of implementing JavaScript hacks that let users customize their browsing environment, filtering site content or changing page behaviors in ways that make themes and tabbed browsing seem almost quaint by comparison.

Because of Greasemonkey, I will never see another Google AdSense ad again. I can make links to the New York Times site call the printer-friendly (ad-free) version of the page. I'm not a fan of About.com; now I can block those links from Google search returns.

Greasemonkey is more than just TiVO for the Web, however. Want to force Yahoo Mail to use the secure login screen by default? Greasemonkey can help. Want to listen to MP3s in your browser rather than launching RealAudio or Windows Media Player when you click on a URL ending in .mp3? Greasemonkey can help. Want to get rid of an annoying bug in a site you use frequently? Yes, Greasemonkey can help.

One Greasemonkey script changes the colors on the Slashdot Web site.
Click to enlarge image.

The list of scripts is nearly 200 deep and growing every day. Some scripts have universal appeal, like Linkify, which turns text links into clickable URLs. Others are highly individualized, like one that filters out writer Xeni Jardin's posts to the digerati blog Boing Boing. Some are site-specific (Google and Yahoo are favorite targets), while others can be used across the Web.

For those interested in the technical aspects, Greasemonkey loads the script into the Document Object Model (DOM) after the DOM is fully loaded, but before onload occurs. In other words, the script slips in between your browser's capturing of the page code and its display on your screen. According to the World Wide Web Consortium (W3C), the DOM is "is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents." Greasemonkey is basically a GUI into this feature.

Getting Greasy
Installing the Greasemonkey .xpi (Firefox's proprietary extension filetype) is just like adding any other extension or theme to Firefox -- a couple clicks and it's done.

Adding (and removing) the scripts that are Greasemonkey's purview is just as easy. You don't need to restart your browser to implement scripts, so testing them is quick and painless. Once installed, Greasemonkey adds two menu items to Firefox's Tools menu, titled 'Install User Scripts' and 'Manage User Scripts':

There are two ways to install scripts:

  1. Most of the time (as with the script links in the text above), you'll be taken to a page that simply displays the JavaScript code itself. If you select your Tools menu in Firefox on such a page, you'll see that the Install User Script option will be active. (Alternatively, right-clicking on a link to a script invokes Install User Script in the contextual pop-up menu.) Select Install User Script to bring up a dialog box, accept the script, and you're done.

  2. In rare cases (as with the CustomizeGoogle script), the author provides a browser interface that lets you install the script.

To remove a script, simply select Tools > Manage User Scripts and follow the prompts. You can also turn a script on and off by clicking a check box or exclude certain Web pages from being affected by the script.

Itching to create your own hack? Writing a script is relatively easy (assuming you are comfortable with JavaScript), and the Greasemonkey page has a basic tutorial, although it's clearly not intended for the absolute novice. The beauty of Greasemonkey, however, is that since it's open source you can simply copy, paste, and tweak other people's scripts. Filtering the ads from your favorite site is as easy as replacing the URL in an existing script and loading your new script into Firefox.

No Warranty Expressed Or Implied
A small caveat: Because Greasemonkey uses JavaScript, keep in mind the standard cautions regarding trusting sources, as JavaScript can be a significant security risk. That said, I have never been bitten by anything I've installed from within the mozilla.org domain. Incidentally, for an excellent rebuttal to JavaScript-related security concerns, check out the Greasemonkey blog.

The Upshot
Not only is Firefox proving to be a powerful means of evangelizing open-source software, but it is leading the charge to draw users up the computing learning curve. Greasemonkey secures Firefox's rightful place in the latest round of the browser wars, and it does so by tapping into those things that make open source so exciting. Greasemonkey harnesses the power of geekdom by providing the casual user with insight into why hackers do what they do.

Politics aside, Greasemonkey is a powerful and exceptionally pleasing tool. It radically enhances your browsing by turning Firefox's already excellent personalization features up another notch.

Recommended Greasemonkey Scripts
(Greasemonkey comes with ununderline and Popup Window Fixer preinstalled. The first is an aesthetic tweak that italicizes underlined text so you won't confuse it with hyperlinks. The second forces pop-up windows to render without, rather ironically, the use of JavaScript so that you can see the URL which is often hidden in JavaScript pop-ups.)

CustomizeGoogle: Removes ads and adds links to other services in Google search results.

Linkify: Turns text URLs into clickable links.

CNN: Remove ad column: Just what it says.

Hide Iframes: Turns off banner ads on many sites. This is one of the more universal scripts and will catch content on any site that uses the CSS Iframe coding.

Inline MP3 player: Inserts an inline play button after any link ending in .mp3; click the button to play the MP3 file in Firefox (requires Flash plug-in).

Unembed: Allows you to right-click and download movies that are embedded in the page and thus "locked" into the browser.

Michael Jackson remover: Remove the Freaky One from Reuters and Bloglines pages. If you are willing to make some very simple changes to the JavaScript, you can modify this one to filter anything from almost any news site.

Destroy Target: Alas, this one does not, in fact, allow you to use your computer as a weapon, as the Target store in my town is still standing. What it does do is prevent links from opening in new windows. Good for controlling any pop-ups that sneak by other Firefox scripts and filters.

For a fairly comprehensive collection of known scripts, see the Greasemonkey Script Repository.

More Information
Firefox Central
Install Firefox
Install Greasemonkey
Tutorial: Using Greasemonkey
Tutorial: Writing User Scripts
Greasemonkey Script Repository
Greasemonkey Blog

Related Stories
Make Firefox A Perfect Fit
Mozilla browsers offer a much higher degree of user customization than meets the eye. Here are ways to tweak Firefox to fit your needs.

Fire Up Firefox: Our Favorite Extensions
Several Pipeline editors get together to extol the virtues of their favorite Firefox extensions.

Review: Firefox 1.0, The New World Wide Web Champ
Scot Finnie's original and very detailed review of Mozilla's browser, updated on December 20, 2004.

Firefox Eats More Microsoft Market Share
Market share for the open-source Mozilla Firefox climbed above 6% in February, while Microsoft's Internet Explorer share dropped below 90%.

Never Miss a Beat: Get a snapshot of the issues affecting the IT industry straight to your inbox.

You May Also Like

More Insights