[Zotero 7] API request: protocol handler

82 views
Skip to the first unread message

XY Wong

unread,
26 Sept 2022, 09:20:4026/09/2022
to zotero-dev
Hi,

In the plugin Better Notes, I override Zotero's protocol handler script to add extra protocol for notes links, i.e. zotero://note/u/KEY/?params, in the manifest. Is it possible to do similar things in Zotero 7? This is one of the core support for this plugin to link notes together.

Also, I would like to request an API to allow plugins to add new protocols starting with zotero://, which would definitely benefit plugin developers! Would that be possible?

Thanks!

Dan Stillman

unread,
26 Sept 2022, 18:49:5926/09/2022
to zoter...@googlegroups.com
The protocol handler is still functional in Zotero 7.

But it looks like you're currently overriding the entire
zotero-protocol-handler.js file in chrome.manifest, replacing it with
your own copy. That's really not OK — monkey-patching is one thing, but
this means that any changes to the protocol handler in Zotero, including
bug fixes, wouldn't take effect for anyone with your plugin installed.
Please stop doing that ASAP and avoid similar overwriting in the future.

You can access the protocol handler extensions via
`Services.io.getProtocolHandler('zotero').wrappedJSObject._extensions`.
I haven't tested it, but I would think you could just add a function
there to add support for a new prefix.

- Dan

XY Wong

unread,
29 Sept 2022, 06:07:4329/09/2022
to zotero-dev
Thank you Dan! I've made an update to the plugin and the protocol handler is added without overriding the Zotero .js file.
Reply all
Reply to author
Forward
0 new messages