ServerGrease

Description

ServerGrease is a minimal Mozilla extension that allows the browser to include configuration and extra functionality (normally installed via client-side extensions) hosted on a webserver. This allows multiple browsers to be configured from a central location.

Technical description

Every time a Mozilla browser starts up with this extension installed, it loads the specified remote .js file and runs it. It evaluates the script (and therefore bypasses most of the browser's security), allowing the script to modify the browser's behavior in most of the same ways that client-side extension code does.

Browser modifications other than .js (eg. XUL GUI changes) aren't currently supported.

Installation

  1. Install servergrease.xpi.
  2. Type "about:config" in the location bar. Right click in the settings, select New > String, and fill in the following information:
    Preference name servergrease.loadURL
    String value (the URL of the .js file to be loaded at startup)
  3. Restart the browser.

Documentation

Once server-hosted code is running, it can run the same code as extensions use. In addition, the following function is provided, so that code can be split across multiple files:

sgrease_import(url) — loads and evals the javascript at the given URL.

The server-side files are cached by the browser. To reload the newest version of a file without restarting the browser, open the desired file as a webpage, hard-reload the page (Ctrl+R), open a new window (Ctrl+N), and close all old windows.

Example: Keyword bookmarks

This script is an implementation of server-hosted keyword bookmarks. It also implements some features not normally found in keymarks, including the ability to have "default" arguments, and to modify the arguments.

Caveats

I'm not completely familiar with Firefox browser security. It's possible that sgrease_import()'s security could be improved. It's possible it could be a bad idea, or have large holes in it. If you have input, feel free to contact me.

License

The source code is available under the GPL.

The name "ServerGrease" is intended to be reminiscent of Greasemonkey, another extension that focuses on enabling ease-of-use with small bits of javascript. However, the extensions implement noticably different functions, and the name is hopefully not similar enough to be confusing.