How to write Greasemonkey scripts

by nixcraft on March 5, 2006 · 11 comments

Greasemonkey is a Mozilla Firefox extension that allows users to install scripts that make on-the-fly changes to specific web pages. Greasemonkey can be used for adding new functionality to pages.

Most Greasemonkey user scripts are written by hand, using site-specific JavaScript code which manipulates the contents of a webpage using the Document Object Model interface

Dive Into Greasemonkey is a book about programming with Greasemonkey, a Firefox extension for customizing web pages. According to this book "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 web site more readable or more usable. You can fix rendering 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 a web page out loud or convert it to Braille. You can even automatically retrieve data from other sites to make two sites more interconnected."

The book covers installation of Greasemonkey to various Advanced Topics. I find it very helpful. This book, its sample code are under terms of the GNU General Public License.
=> Download PDF Version (167K)

=> Download HTML Version (253K)

=> Read online.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 9 comments… read them below or add one }

1 Shane November 15, 2006

Yea greasemonkey is pretty awesome in the right hands. But you put it in the hands of Jason Calacanis it can be downright eveil. Its no secret I can’t stand jason calacanis. I rant about him all the time on < DELETED dead url by admin >

Reply

2 tim July 15, 2011

url fail. at least his (domain) still exists. lol

Reply

3 _asais November 18, 2006

Didn’t know about these Greasemonkey scripts, but is sounds like something interesting :)

Reply

4 Heinz The Man June 16, 2008

If you install IE7 Pro which is an add on for Internet Explore, you can also get greasemonkey scripts for IE7.
Besides you get a lot other, like adblocker and so on.

// Heinz The Man

Reply

5 Zhe Jerman May 18, 2010

Installing IE7 is like putting a beetle engine in a Porsche

Reply

6 Dan May 21, 2010

Greasemonkey is my new toy in the cyber world. :D

Reply

7 Hari September 23, 2010

In section 2.3, the reason the “bad example” doesn’t work is because it passes a dynamic javascript snippet instead of the function itself. In other words, instead of using the anonymous function, it can as well be written as “window.setTimeout(helloworld, 1000)”. BTW, the timeout is in milliseconds, so it should be 1000, not 60.

Reply

8 rudraksha September 22, 2011

It rocks. Very good work.

Reply

9 TK December 18, 2011

The links are most assuredly broken.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 15 + 14 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: