Translations of this page:

We’re in the process of updating the documentation for Zotero 5.0. Some documentation may be outdated in the meantime. Thanks for your understanding.

Setting up a working environment

First you should set up an extension development environment. (Do not set nglayout.debug.disable_xul_cache to true unless you know what you're doing, as it breaks parts of Zotero.) Above all you should create a development profile so that you do not screw up your default Firefox profile. On Linux you can start a second instance of Firefox from the command line (replace 'dev' with the name of your development profile):

firefox -no-remote -P dev

Within this profile install the Firefox extensions JavaScript Debugger (Venkman), Extension Developer's Extension, Console2, Chrome List, Firebug, and Restart Firefox. The Web developer toolbar is also highly useful if you plan to create HTML.

In Venkman you must disable “Exclude Browser Files” in the Debug menu. With Firebug you cannot inspect the Zotero code but it is very helpful to monitor network requests and other stuff.

Now you can finally install Zotero. You should use the latest development XPI. Alternatively install a Subversion checkout of Zotero described here (quite a lot more convenient than installing an XPI, but slightly riskier).

Getting familiar

You find all installed files with the “Explore Chrome” plugin. To dig into the running JavaScript sourcecode start the JavaScript Debugger and select 'zotero.js'. I have not found out yet how to inspect the rest of the Zotero sources!

Open the JavaScript Development Environment (in the Developer's Extension). Replace the example script with the following script and execute:

var Zotero = Components.classes[";1"]
var items = Zotero.Items.getAll(); 
print("Items (" + items.length + "):\n");
for(i=0; i<items.length; i++) {
    var item = items[i];
    var title = item.getDisplayTitle();
    print( i + ": " + title + "\n");

The script will print a summary with a list of all items like this:

version => 1.0.0rc6.r1847, platform => Linux i686, 
locale => en-US, appName => Firefox, appVersion =>
Items (1):
0: Zotero - Quick Start Guide 

More information can be found at JavaScript API. You should now be able to write and test small scripts that interact with Zotero.

Plugin development

A Zotero plugin is a Firefox extension of its own which can be installed in addition to Zotero. The plugin then interacts with Zotero from within Firefox. The advantage of a plugin is that you can mostly create it as you like without bothering much with other developers. The disadvantage is that you cannot really modify the basics of Zotero and with each update of Zotero your extension might not work anymore.

An example is provided with the sample plugin. To create a new a plugin, you can simply start with the sampe: download the sources with subversion to a local working directory of your choice. Within Firefox select the Extension Builder of the Extension Developer's Extension and point it to the working directory. Click “Install for Development” and restart Firefox.

The sample plugin will show you an annoying alert whenever an item is added, modified or deleted in Zotero, so you should quickly edit chrome/content/helloworldzotero/hello.js and change this behaviour. Just change line 92 from



alert("Sorry for bothing, I just wanted to tell you:\n" + str);

Save the file, restart Firefox and the alert is at least polite. You can now call yourself a firefox extensions hacker :-)

More Information about Firefox extension development can be found in the extension development documentation project.

Zotero development

If you want to make code changes to the current branch of the Zotero, you need to checkout a Subversion working copy.

svn co zotero

In the Extension builder of the Extension Developer Extensions choose and add the working directory for development. Modification at the source file affect Zotero each type you restart the browser. Do not forget to update regularly via Subversion instead of installing the online XPI!.

Please note the Coding Guidelines.

dev/getting_started.txt · Last modified: 2017/11/12 19:53 (external edit)