Mobile access to Zotero attachments on WebDAV

Using my Android tablet, I wanted to browse my Zotero library online via zotero.org and easily access my pdf attachments which Zotero stores as zip files on WebDAV, so I wrote a bookmarklet to help. This should work on most mobile devices and browsers. It can also be used to access your attachments on any computer without Zotero installed.

All I do, using my Chrome browser on the tablet, is go to the item in my library at zotero.org, click on the 'Attachment Details' link for the attachment I want, then in the browser's address bar I start typing the name of the bookmarklet to select it - similar to how I'd use the official Zotero bookmarklet for adding references to my library.

Here are the instructions if you want to install the bookmarklet:

1) Bookmark this page (can do it on the desktop if you have your bookmarks syncing to the mobile device).

2) Edit the bookmark you just created.

3) Change the title to something appropriate such as "Zotero WebDAV attachment downloader".

4) Copy the code below and paste it as the URL for the bookmark (make sure you select it all, including the "javascript:" at the beginning and the "();" at the end.

javascript:(function(){var WebDAV = 'https://your.WebDAV.provider.com/{subfolders}/zotero/' ; var ItemKey=window.location.toString().match(/^https?:\/\/www\.zotero\.org.*\/itemKey\/(\w*).*/i);if(WebDAV==='https://your.WebDAV.provider.com/{subfolders}/zotero/'){alert('The URL of this bookmarklet must be edited to include the URL of your WebDAV folder for Zotero attachments. You can get it from your Zotero preferences in the sync pane, but make sure to retain a leading: \'http:// or \'https:// and a trailing: /zotero/\' when you edit me');}else{if(ItemKey){window.location=WebDAV+ItemKey[1]+'.zip';}else{alert('No Zotero item found on page. Run this bookmarklet while viewing an "Attachment Details" page in your library at www.zotero.org');}}})();
5) Edit your bookmarklet's URL to include the correct URL for your own WebDAV storage where it says near the beginning: 'https://your.WebDAV.provider.com/{subfolders}/zotero/'
(You can just copy the URL for your WebDAV storage from your Zotero preferences, under File Syncing, but makes sure you keep 'http:// or 'https:// at the beginning and /zotero/' at the end.)

6) You might also need to install a file manager on your device to open up the zip file, and a pdf reader. ES File Explorer and Adobe Reader (free from Google Play Store) work fine for my purposes.
  • I edited the post above to improve the bookmarklet code and fix a bug.
  • This sounds very helpful! I tried it, but I get the following error (using box.com):

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
    <s:exception>Sabre_DAV_Exception_NotFound</s:exception>
    <s:message>File not found: JSZFKDAZ.zip</s:message>
    </d:error>
  • Just tried it with iPad and box.com, and it worked nicely. Many thanks.
Sign In or Register to comment.