advertisement

Print

What Is Greasemonkey

by Mark Pilgrim, author of Greasemonkey Hacks
09/01/2005
Greasemonkey
Greasemonkey is a Firefox extension that allows you to write scripts that alter the web pages you visit. You can use it to make a website more readable or more usable. You can fix bugs that the site owner can't be bothered to fix themselves. You can alter pages so they work better with assistive technologies that speak to a web page aloud or convert it to Braille. You can even automatically retrieve data from other sites to make two sites more interconnected.

In This Article:

  1. Getting Started
  2. The Anatomy of a User Script
  3. Coding a User Script
  4. Managing User Scripts
  5. Finding User Scripts

By itself, Greasemonkey does none of these things. In fact, after you install it, you won't notice any change at all, until you start installing what are called "user scripts." A user script is just a chunk of JavaScript, the same scripting language you use on your own website. But user scripts don't run on your own website; they can run on any website, and they can do anything JavaScript can do. In fact, they can do more than that, because Greasemonkey provides special API functions that give user scripts even more power than traditional JavaScript.

Greasemonkey has existed for less than a year, and hundreds of people have already written thousands of Greasemonkey scripts to scratch their own personal itches. Web enthusiasts with zero JavaScript experience have written scripts to route around broken websites, alter site styles, and "roll back" ill-conceived site redesigns. More experienced coders have created link trackers, password managers, and personal shopping agents. Some have even added entirely new features to complex web applications--without ever needing to talk to the application developers or wait for bureaucratic approval.

Clearly, there were a lot of itches waiting to be scratched.

Getting Started

The first thing you need to do to get started with Greasemonkey is install it. Open Firefox and go to greasemonkey.mozdev.org. Click the Install Greasemonkey link. (At time of writing, the latest version is 0.5.1.) Firefox may not let you install it, since it maintains a whitelist of websites that are allowed to install software on your machine. (See Figure 1.)

figure 1
Figure 1: Extension whitelist

Type the address sand click "Allow" to allow this site, then click the "Install Greasemonkey" link again. This time, Firefox will pop up the Install dialog to confirm that you really want to install it. After Greasemonkey downloads, quit Firefox and relaunch it to finish the installation.

As I said, Greasemonkey doesn't do anything by itself, except add a few items to the Tools menu and the right-click context menu. All Greasemonkey does is enable you to install "user scripts" that customize specific web pages.


Greasemonkey Hacks

Related Reading

Greasemonkey Hacks
Tips & Tools for Remixing the Web with Firefox


Pages: 1, 2, 3, 4

Next Pagearrow