Share on Facebook Share on Twitter Email
Answers.com

Greasemonkey

 

A Firefox extension that adds programming functionality to JavaScript for creating more Web page retrieval options when using the Firefox browser. Greasemonkey "user scripts" can be used to eliminate pop-ups or certain parts of selected pages as well as extract information that is typically under the covers. Some scripts mix content from several sites.

A script can change the appearance of all pages retrieved or just alter the behavior of a specific page from one site. A myriad of scripts is readily available from the Greasemonkey repository. For more information, visit www.userscripts.org and www.greasespot.net. See Firefox.

Download Computer Desktop Encyclopedia to your iPhone/iTouch

Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
Wikipedia: Greasemonkey
Top
Greasemonkey
Gm icon.png
Original author(s) Aaron Boodman
Developer(s) Anthony Lieuallen, Johan Sundström [1]
Stable release 0.8.20090920.2 / 2009-09-20
Written in JavaScript, XUL, CSS
Operating system Cross-platform
Available in English
Type Mozilla extension
License Expat License
Website www.greasespot.net
Mozilla Firefox
(category)
Contents
Origins and Lineage

Greasemonkey is a Mozilla Firefox add-on that allows users to install scripts that make on-the-fly changes to HTML web page content on the DOMContentLoaded event, which happens immediately after it is loaded in the browser (also known as augmented browsing). 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 functions 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.

Contents

Technical details

Greasemonkey user scripts are written in JavaScript with limitations[2] and manipulate the contents of a web page using the Document Object Model interface. Scripts are site-specific and written by hand. userscripts.org maintains a database of Greasemonkey scripts, and for each, lists the URLs of web pages to which the script pertains. When the user visits a matching website, Greasemonkey invokes the relevant scripts, which can modify a webpage in any way JavaScript could. Greasemonkey scripts can also poll external HTTP resources via a non-domain-restricted XMLHTTP request. Scripts are named somename.user.js, and Greasemonkey offers to install any such script when a URL ending in that suffix is requested. Greasemonkey scripts contain optional metadata, which specifies the name of the script, a description, relevant resources to the script, a namespace URL used to differentiate identically named scripts, and URL patterns for which the script is intended to be invoked or not.

Writing a Greasemonkey script is similar to writing JavaScript for a web page, with some additional allowances such as cross-site XMLHttpRequests. Compared to writing a full-fledged Firefox extension, user scripting is a very modest step up in complexity from basic web programming. However, Greasemonkey scripts are limited due to security restrictions imposed by Mozilla's XPCNativeWrappers. For example, Greasemonkey scripts do not have access to many of Firefox's components, such as the download manager, IO processes or its main toolbars. Additionally, Greasemonkey scripts run per instance of a matching webpage. Because of this, managing lists of items globally is difficult. However, script writers have been using cookies and Greasemonkey even offers APIs such as GM_getValue and GM_setValue to overcome this.

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 that which 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 retrieving correlating information from related pages on the same site, or other sites. (For example, list the prices of competing retailers' for the same product.)
  • In general, take advantage of extended JavaScript behavior to add previously non-existent functionality to pages. (For example, collate RSS feeds on the current page into a floating panel.)

Compatibility

Greasemonkey is available for Firefox, Flock and Epiphany. 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[3] and Songbird.[4]

Equivalents for other browsers

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.[5]

For Internet Explorer, similar functionality is offered by IE7pro and iMacros.

As of November 2008, there is limited support for Greasemonkey scripts in the Chrome beta (since build 3499) and development releases.[6] It is disabled by default, but can be enabled by adding --enable-greasemonkey as a startup parameter. As there is currently no method to load scripts within Chrome, scripts must be placed into the \scripts directory for Chrome, and into the "user data directory" for newer builds of Chromium.[7] Chrome ignores @exclude metadata within the scripts, so the scripts are executed for all domains/pages. On the other hand, Chromium honors the @include directives and executes the scripts only for the domains/pages specified. In Chrome, scripts that use one of the GM_setValue or GM_getValue initiatives will break, and scripts that use the popular E4X standard will not run.

On Safari (and other Webkit applications), there is a SIMBL-managed plug-in called GreaseKit.

See also

References

External links


 
 

 

Copyrights:

Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2009 Computer Language Company Inc.  All rights reserved.  Read more
Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Greasemonkey" Read more