Skip to main content
Zotero Connectors store their configuration in the Zotero.Prefs namespace, a thin synchronous cache layer backed by browser.storage.local (in BrowserExt builds) or the equivalent Safari storage API. All preference keys and their defaults are defined in src/common/zotero.js and overridden per-browser in src/browserExt/prefs.js or src/safari/prefs.js. The preferences UI (src/common/preferences/preferences.jsx) and the raw config editor (src/common/preferences/config.jsx) are built with React and opened as a full browser tab.

The Zotero.Prefs API

Reading preferences

Zotero.Prefs.get() in an injected script (content script) will throw if the preference has not been pre-loaded via loadNamespace(). Always use getAsync() in injected code, or ensure the namespace has been loaded first.

Writing and clearing preferences

In the BrowserExt implementation (src/browserExt/prefs.js), set() and clear() are async and write through to browser.storage.local. The in-memory syncStorage object is updated immediately so subsequent synchronous get() calls reflect the new value.
browser.storage.local has a 10 MB limit per Chrome’s documentation. The connector approaches this limit when caching many translator source files. If a set() call fails due to quota exhaustion, the BrowserExt prefs.js automatically evicts five randomly chosen cached translator code entries and retries.

Inspecting all preferences

Pre-loading namespaces in injected scripts

Because injected scripts cannot access browser.storage directly, they must ask the background page to relay preferences. loadNamespace() fetches all preferences whose keys start with the given prefix and populates syncStorage so they can be read synchronously afterwards:
loadNamespace() throws if called from a background page. All preferences are always available synchronously in the background via the in-memory cache.

Clearing cached translator code

This is exposed in the Preferences → Advanced pane as the Reset Translators button, which calls removeAllCachedTranslators() and then forces a fresh fetch from the repository.

The Preferences UI

The preferences window is defined in src/common/preferences/preferences.html and src/common/preferences/preferences.jsx. It is registered as the extension’s options page:
Open it programmatically from any extension context with:

Panes

The preferences window has three panes:

General

Zotero client connection status, zotero.org authorization, and (in BrowserExt) the Import BibTeX/RIS/Refer files MIME-type handler setting.

Advanced

Debug logging, translator cache reset, error reporting, keyboard shortcuts, Google Docs integration, and the Open Translator Tester button (debug builds only).

Proxies

Proxy redirection settings and the configured proxy list. BrowserExt only — this pane is hidden in Safari builds.
The active pane is controlled by the URL fragment: preferences.html#proxies opens the Proxies pane directly. Preference checkboxes that carry a data-pref attribute are wired up automatically:

The Config Editor

The config editor (src/common/preferences/config.html + config.jsx) shows every raw preference key and its current value in a filterable table. It is intended for power users and developers. Access it from Preferences → Advanced → Config Editor. A confirmation dialog warns that changing settings can harm stability and security before the editor opens. In the editor you can:
  • Filter preferences by key name
  • Double-click a row to edit its value (booleans toggle automatically; other types prompt for a new JSON-encoded value)
  • Reset any preference to its default with the Reset link
  • Add a new preference key/value pair with Add Preference
The table is rendered by Zotero_Preferences_Config.Table (React) and calls Zotero.Prefs.getAll() on load to populate itself.

Preference Reference

All defaults are defined in the DEFAULTS object inside Zotero.Prefs (src/common/zotero.js).

General preferences

Translator cache preferences

Proxy preferences

All proxy settings live under the proxies. namespace and are available after Zotero.Prefs.loadNamespace('proxies').

Debug preferences

Integration preferences

Storage Backend

Preferences are stored in browser.storage.local. The BrowserExt prefs.js overrides Zotero.Prefs.init(), set(), and clear() to read and write through this API. init() loads the entire storage area into syncStorage at extension startup:
Subsequent get() calls are served from the in-memory syncStorage object without hitting storage again.