Greasemonkey
From Wikipedia, the free encyclopedia
Greasemonkey | |
---|---|
Screenshot of the BookBurro user script running in Greasemonkey. BookBurro alters an amazon.com page to show the prices of the same book offered by competing retailers. |
|
Design by | Aaron Boodman |
Developed by | ? |
Initial release | ? |
Latest release | 0.7.20080121.0 / 2008-01-21 |
OS | Cross-platform |
Available in | English |
Genre | Mozilla extension |
License | Expat License |
Website | www.greasespot.net/ |
Mozilla Firefox (category) |
---|
Contents |
Origins and Lineage |
|
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.
Contents |
[edit] Technical details
Most Greasemonkey user scripts are written by hand, using site-specific JavaScript code which manipulates the contents of a web page using the Document Object Model interface. userscripts.org 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.user.js, and Greasemonkey automatically detects and offers to install any such script, when a URL ending in that suffix is loaded. In addition to JavaScript code, Greasemonkey scripts contain limited optional metadata, which specifies the name of the script, a description, 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 restrictions imposed by the security provisions of Mozilla's XPCNativeWrapers. Compared to writing a full-fledged Firefox extension, user scripting is a very modest step up in complexity from basic web programming, but for the JavaScript illiterate and non-programmer incapable of writing a user script, the Platypus [1] extension allows them to edit a page (deleting or moving parts of it around) to create persistent Greasemonkey scripts automating their changes.
[edit] 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 page content and layout beyond what the author considered. (For example, add table headers, floating elements, 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, and/or other sites. (For example, show a list of competing retailers' prices for the same product.)
- Add extended JavaScript behavior to pages. (For example, discover RSS feeds on the current page, displaying them in a floating panel. Let the user save an FLV file from popular video streaming sites such as Google Video, YouTube, and Facebook.)
[edit] Technical, operational, and ethical issues arising from user scripting
It has been suggested that some of the information in this article's Criticism or Controversy section(s) be merged into other sections to achieve a more neutral presentation. (Discuss) |
The neutrality or factuality of this article or section may be compromised by unattributed statements. You can help Wikipedia by removing weasel worded statements. |
The neutrality of this article is disputed. Please see the discussion on the talk page.(May 2008) Please do not remove this message until the dispute is resolved. |
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.
- 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 Flash, Flex, and Silverlight content within Web pages.
- 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.
- 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 userscripts to update themselves; some developers added such functionality to their userscripts but most of them remain static, and eventually break.
[edit] Greasemonkey compatibility and equivalents for other browsers
[edit] Other Mozilla-based browsers
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 is also a custom version for SeaMonkey: [2]. There is also a version out for Songbird.
[edit] Opera
Version 8 of Opera also adds user scripting functionality. As both Opera and Firefox support the W3C DOM, many Greasemonkey user scripts also work correctly on Opera.
[edit] Safari
GreaseKit (formerly Creammonkey) and PithHelmet (shareware) are similar tools for the Safari browser and other WebKit based applications such as MailPlane.
[edit] Konqueror
Konqueror Userscript is a webpage manipulation tool for KDE's Konqueror browser which aims for compatibility with Greasemonkey scripts and metadata. It is available as a KPart.
[edit] Internet Explorer
For Internet Explorer, IE7pro, iMacros, Trixie (last updated 2005), Turnabout (last updated 2006) and Greasemonkey for IE (last updated 2006) offer similar functionality. Turnabout used to be open source software (under the BSD License), but as of September 2006, the source code is no longer available.
[edit] Similar software
[edit] 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.
- Bookmarklets can execute arbitrary JavaScript on any page, but they require a user to click them, rather than running automatically.
- 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.
- 3D3R Bubbles is the first Site-Specific-Browser, and it uses JS injection of user-scripts, very much like GreaseMonkey.
[edit] Proxy level
- 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.
- Proxomitron, available since late 1990s, predates JavaScript active browsing and provides similar functionality for all browsers using a regexp-like matching language.
- 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.
[edit] Alternatives
Without an extension like Greasemonkey, modifications to websites can also be done in one of the following ways:
- Entering javascript: URLs in the Location Bar or using bookmarklets
- Using the browser's DOM Inspector
- Using a full-fledged extension that serves the same purpose
- Using a local HTTP proxy that modifies the HTML, such as WebWasher or Proxomitron
- Using the Opera browser and user.js scripts
[edit] See also
[edit] External links
- Homepage of the Greasemonkey extension
- Greasemonkey Wiki
- Dive Into Greasemonkey - A free online book on Greasemonkey script writing by Mark Pilgrim
- UserScripts.org (formerly Greasemonkeyed.com) - User script repository
- UserStyles.org - User styles (CSS) for Stylish extension (many of which are also available in Greasemonkey format)
- UserJS.org - User Javascripts for Opera (many of which are also available in Greasemonkey format)
- Greasemonkey etiquette
- Greasemonkey and its effect on business models
- Greasemonkey script compiler Converts Greasemonkey scripts into extensions
- Script compiler for conversion of Greasemonkey scripts to extensions
- Greasemonkey compiler converts Greasemonkey user scripts into full-fledged extensions
- Greasemonkey Explained for non-techies
- Greasemonkey in the Enterprise - blog series on security and deployment issues when using Greasemonkey for IT projects
- InternetDuctTape.com - Beginner's Guide to installing and using Greasemonkey user scripts
[edit] External reviews
- Festa, Paul. "Firefox add-on lets surfers tweak sites, but is it safe?", CNET, 24 March 2005.
- Singel, Ryan. "Firefox Users Monkey With the Web?", Wired magazine, 17 May 2005.