Greasemonkey is a Mozilla Firefox extension that allows users to install scripts that make on-the-fly changes to most HTML-based web pages. As Greasemonkey scripts are persistent, the changes made to the web pages are executed every time the page is opened, making them effectively permanent for the user running the script.
Greasemonkey can be used for adding new functionality to web pages (for example, embedding price comparison in Amazon.com web pages), fixing rendering bugs, combining data from multiple webpages, and numerous other purposes. Well-written Greasemonkey scripts can integrate changes so well that their additions appear to be natural parts of the web page.
code which manipulates the contents of a web page using the Document Object Model
maintains a database of Greasemonkey scripts, and for each it lists the URLs
of web pages to which the scripts pertain. (N.B. The obsolescent script repository might
contain some older scripts that have not yet migrated to the new repository
) When the user loads a matching page, Greasemonkey invokes the relevant scripts, which can then add to the page, delete parts of it, or move parts around. Greasemonkey scripts can also poll external HTTP resources via a non-domain-restricted XMLHTTP
request. Greasemonkey scripts are named somename
Typical Greasemonkey scripts
Users have written scripts that:
- Auto fill forms.
- Alter the formatting of text, borders, graphics, etc. (For example, highlight first-run programs in a TV listing.)
- Remove specific content, such as advertising, popups, even whole sections of a page. (For example, filter specific posters from a message board site.)
- Alter content and layout beyond what the page author considered. (For example, add floating elements, make elements collapsible, etc.)
- Add links, buttons, or any other type of HTML element anywhere on the page. (For example, embed Google Reader into Gmail, thus providing an RSS feed option.)
- Enhance the content of pages by correlating information from related pages on the same site, or other sites. (For example, list the prices of competing retailers' for the same product.)
Technical, operational, and ethical issues arising from user scripting
Some in the Firefox community, and a number of technical analysts, warn that widespread use of Greasemonkey and related user scripting technologies will require care in deployment. Their concerns include:
- Possible disruption to revenue of some Websites. Some Firefox users already block Web advertisements with Adblock Plus, but Greasemonkey may be used to change ads from one company to those of their competitor, to artificially inflate Web advertising scores, or to fool the statistics programs run by paid browsing companies.
- Increases in the Web traffic that arise from some scripts. Such Greasemonkey scripts obtain additional information about pages the user visits, for example from services such as del.icio.us and Bloglines. If these scripts were widely used, they would cause substantial additional traffic to the target Websites. An example is a script that retrieves data for every link on the page through XMLHttpRequests.
- The proliferation of scripts acting on many pages, and the difficulty of distinguishing whether problems in a page are caused by actual Web-programming bugs or by local Greasemonkey scripts, may make troubleshooting defects more difficult.
- Script errors resulting from lack of coordination between Greasemonkey developers and the original Website developers.
- Greasemonkey only works on HTML-based pages, and does not work on Java, Flash, Flex, and Silverlight content within Web pages. An exception is where you attribute an embedded flash with the
swliveconnect=true attribute, enabling you to modify variables in the Flash file.
- Rich Internet Applications are more difficult for a Greasemonkey script developer to control than static Web pages. This is because the more logic that a page performs, the more complexities there are to consider for the Greasemonkey script writer to develop a script that will not interfere with the original application's functionality, and because of the high likelihood of further content being loaded (via XMLHttpRequest) after the main page load has completed.
- The original site developers can release a new version of the site that causes the Greasemonkey script designed for that site to stop working. Therefore, a Greasemonkey script written for a specific site without developer coordination cannot be considered a long-term solution.
- There is no official way for user scripts to update themselves; some developers added such functionality to their userscripts but most of them remain static, and eventually break.
Greasemonkey compatibility and equivalents for other browsers
Other Mozilla-based browsers
Greasemonkey is available for Firefox, Flock
. The Epiphany Greasemonkey extension is part of the Epiphany-extensions
package. However, this extension is not fully compatible as of release 2.15.1, since some Greasemonkey API
functions (e.g. GM_getValue
) are unsupported. There are also custom versions for SeaMonkey
Version 8 and upwards of Opera
also have user scripting functionality
Both Opera and Firefox support the W3C DOM. Opera is capable of running many Greasemonkey user scripts.
) and PithHelmet
(shareware) are similar tools for the MacOS
version of the Safari
browser, along with other WebKit based applications such as MailPlane.
is a webpage manipulation tool for KDE
browser which aims for compatibility with Greasemonkey scripts and metadata. It is available as a KPart
For Internet Explorer
, similar functionality is offered by IE7pro
(last updated 2005), Turnabout
(last updated 2006) and Greasemonkey for IE
(last updated 2006). Turnabout used to be open source software
(under the BSD License
), but as of September 2006, the source code is no longer available.
Browser level only (Firefox)
- AlchemyPoint combines a Firefox extension with a client side Proxy Server to allow for manipulation of web content, scraping of data from websites, detection/parsing of microformats, etc.
- Chickenfoot is a Firefox extension that aims to enable both end-user programmers and hackers to script interactions on the Web.
- iMacros for Firefox is a Firefox extension that allows the user to record and replay so called "Internet Macros" for web automation, web scraping or web testing.
- Stylish is a Firefox extension that allows for client-side manipulation of webpage content through Cascading Style Sheets.
- Firebug is a developers extension which allows arbitrary realtime changes to a page's DOM
- Super GreaseMonkey is a mod of GreaseMonkey which supports runtime libraries (specifically jquery) for user scripts.
- Bubbles is the first Site-Specific-Browser, and it uses JS injection of user-scripts, very much like GreaseMonkey.
- Monkeygrease is a Java Servlet which can be used to alter the output of a closed-source Java web application before its output is sent to the client.
- Proximodo, inspired by- and interoperable with proxomitron, is an open source, client side proxy server which allows manipulation of page content
- Privoxy is an open source, client side proxy server which allows manipulation of page content available in many OS flavors
- MouseHole is a client side proxy server which allows manipulation of page content using Ruby.
Without an extension like Greasemonkey, modifications to websites can also be done in one of the following ways:
- Using the browser's DOM Inspector
- Using a full-fledged extension that serves the same purpose. (It is indeed possible to convert much of the code in a GreaseMonkey script to become part of a Firefox extension. Indeed this is how GreaseMonkey scripters often "graduate" to becoming extension writers.)
- Using a local HTTP proxy that modifies the HTML, such as WebWasher or Proxomitron
- Using the Opera browser and user.js scripts