Greasemonkey Manual:Installing Scripts

From GreaseSpot Wiki
Revision as of 07:27, 15 December 2007 by Marti (talk | contribs) (Moved heading levels down here)
Jump to navigationJump to search
Greasemonkey Manual
Using Greasemonkey
Installing Scripts
Monkey Menu
Getting Help
User Script Authoring

About User Scripts

The purpose of Greasemonkey is to manage user scripts. User scripts allow the user to control the way they use the web, by customizing it with scripting. Greasemonkey won't do any good without any scripts installed. So, the first thing an eager user should do is find and install (or write!) a useful script.

First, a word on finding user scripts. They may be located anywhere, on the internet or off. The Greasemonkey community, however, most often uses the general-purpose user scripting site created for it:

To install a script, navigate to it it with Firefox after installing Greasemonkey. This is most often done by clicking a link on a web page, but you may also drag-and-drop a local file into a Firefox window, or use the "File, Open..." dialog to open it.

An aside: What is a user script? Any file that ends in .user.js is a user script. If the URL of a link you click, or otherwise navigate to, ends with .user.js, then Greasemonkey will intercept the loading file, and present its installation dialog.

The Installation Dialog

Greasemonkey Installation Dialog

Whenever you navigate to a user script as described above, Greasemonkey will open its installation dialog, instead of loading the script like a normal page. A thumbnail of this dialog is shown to the right. It displays the name and description of the script, if available, as well as the include and exclude rules that apply.

The install button will, of course, install the script in question. Like the Firefox extension install dialog, the install button is disabled for a few seconds, to avoid the same potential security vulnerability. Likewise, the cancel button will perform the obvious action.

The third button is the View Script Source button, and will also perform the obvious action that the name implies. At this point, Greasemonkey has already downloaded the user script in question, to display the name and other details. When you ask Greasemonkey to show you the script source, it shows you the temporary file that it has already downloaded, as in this screenshot. This, also, is intentionally engineered to avoid a potential security problem, wherein an evil server could deliver one innocent script, for viewing, and on the second load an evil script, for installing. This approach ensures that the script is downloaded only once, and that if you examine the source of a script, that is the script you will install.

Finally, in this view script source dialog, there is an info bar, similar to the extension installation security warning. This bar includes an install button, which, like the button in the prior dialog, will also install the script.

See Also