How do I add a button to my website that says "Add this item to Zotero"?

How do I add a button to my website that says "Add this item to Zotero"?

I've having a very rough time figuring out how to make my site Zotero-ready. The lack of examples on this page:

http://www.zotero.org/support/make_your_site_zotero_ready

is not helping. I've figured out how to get Zotero to recognize items on a page using OpenURL COinS, but it seems that users need to click the little Zotero icon in the address bar and then pick from a menu to add items. Our users aren't likely to figure out how to do this.

Our site has a small, searchable document collection. On the search results page I want to have a link or button next to each item that says "Add this item to Zotero".

Can anyone post a simple example?

(Also -- just for reference -- I found this page:

http://www.zotero.org/support/dev/interacting_with_zotero_from_within_firefox

with the javascript to add items. It seems straightforward, but when I include:

<script type="text/javascript" src="chrome://zotero/content/include.js"></script>

in the page, I get:

Security Error: Content at file:///C:/temp/zoterotest/zt.html may not load or link to chrome://zotero/content/include.js.

So it looks like regular web pages can't access Zotero. Or is there another way?)
  • but it seems that users need to click the little Zotero icon in the address bar and then pick from a menu to add items. Our users aren't likely to figure out how to do this.
    But this is exactly how Zotero works on all sites. There aren't any sites that push data to Zotero; all data is pulled.
  • edited August 20, 2009
    What noksagt said.

    If you do have RIS data, you can serve RIS files with the application/x-research-info-systems MIME type and Zotero with default preferences will ingest it automatically. (On many sites such a link says "Export to EndNote", but RIS isn't EndNote-specific.) In the near future Zotero will support the Bibliographic Ontology and will likely be able to automatically ingest BIBO RDF in the same manner, which will allow for higher quality data. Ideally there'll be client libraries in PHP, Python, etc. to easily generate BIBO.

    But the address bar icon is still the standard way to save to Zotero.
  • Ok. But I still need to add things to Zotero programmatically. We have another use case where a user needs to select some text on a page, and we'd like to create a link to that specific spot and store it in Zotero.

    I can do it if I can get access to Zotero.Items.add() from within a webpage. How can I get around the security restriction?

    I can write a custom Firefox plugin, a Zotero plugin, or a translator if necessary. Just point me in the right direction.
  • We have another use case where a user needs to select some text on a page, and we'd like to create a link to that specific spot and store it in Zotero.
    You realize they can already select text on a page and add it to a Zotero note via right-click? It'll save a link to the page, though not the exact spot on the page.
    I can write a custom Firefox plugin, a Zotero plugin, or a translator if necessary. Just point me in the right direction.
    Zotero plugin (which is just another Firefox extension). Zotero can't really give access to content JS, since it'd be a privacy violation (and greatly increases the potential for security vulnerabilities)

    But it's probably worth explaining what you're trying to do in a bit more detail before starting work on a plugin.
  • > You realize they can already select text on a page and add it to a Zotero note via
    > right-click? It'll save a link to the page, though not the exact spot on the page.

    That might do it, if I can control how the Zotero item is created. Here's the scenario: we have some documents with chapters and line numbers. Users are accustomed to citing parts of the text like this: "book:chapter_name:page_num:line_range:words". For example: "The Book of Foo:Chapter 1:Page 2:Line 3-5:'Hello' to 'World'". (Imagine the word Hello is on line 3 and World is on line 5).

    The document is marked up with all of the structure and metadata, so I can know the exact chapter/line/etc. that the user has selected. I could create the reference above in Javascript if necessary. There's also a bit of metadata like author and date that we'd like to preserve. So if there were a way to insert Zotero items and notes in a precisely controlled way then we'd be set.

    We can't really change the way users cite text because we have several thousand of them, and they're not going to want to change.
  • So if there were a way to insert Zotero items and notes in a precisely controlled way then we'd be set.
    Well, you can do whatever you want from a Zotero plugin. The existing feature (which you can try) certainly won't save chapters, pages, or line numbers, since there are no such concepts in HTML and that's special markup on your end. But you can look at the newNote() and addTextToNote() functions in overlay.js to see how that feature works and use similar code in your plugin. The document metadata you can store in a parent item, and you can perhaps use some encoding in <cite> elements when you add text to child notes (which are just HTML). Those sorts of locators won't be automatically available via CSL, of course (though this is something that, eventually, might be nice to support, and there's been some discussion of it before in these forums, but it would require some consensus on encoding, some hacking on the TinyMCE-based note editor to provide an interface to the data, and perhaps a UI to select the embedded citations from the word processor plugins).
  • Ok, so I'll figure out how to write a Zotero plugin.

    What's the best way to distribute it, assuming we'll have several hundred to a thousand users, all of whom are new to Zotero? Do they have install it separately? Is there any way to make it happen in one go?
  • I'm assuming you don't have network-based control of these machines? If not, you're pretty much left with manual installation by users.
  • Hello,

    Can I put Zotero link on our Library Website? TQ
  • Dk - what exactly do you want to do? I don't understand.
  • We want to put Zotero link on our Library Website. To encourage students to try and use Zotero. Do we need to seek permission for this?
  • You do not need a permission to add link to Zotero site.
  • TQ so much for ur info.
Sign In or Register to comment.