Detect HTTP HEAD code


I'm writing a translator. Zotero 1.0.10 and Scaffold 1.0.2 on Firefox 3.5.5.
It's working pretty well, only now (inside the scrape(doc, url) function) I need to check if the user has access to the attachments. If yes I'll attach a PDF and Full Text, otherwise only the summary page. I know that the server is going to return an HTTP code 200 if the download is allowed, and 403 if it isn't.

I first tried: var http = new XMLHttpRequest()
but that's not working, I get: message => XMLHttpRequest is not defined

So I saw a function Zotero.Utilities.HTTP.doHead(). But I can't get it work.

var testUrl = "..."; // build the URL from data gathered in scrape
var header = Zotero.Utilities.HTTP.doHead(testUrl);

I get the following: message => Zotero.Utilities.HTTP.doHead is not a function

I don't really understand what happens here. I looked in utilities.js for the source code of the function, but it doesn't tell me what to put in onDoneā€¦ I just want it to return true or false depending on the status.

What could you suggest to solve this problem?

Sign In or Register to comment.