4

I'm trying to download some binary data from my Firefox extension. When I try to set a created XMLHttpRequest to arraybuffer mode:

oHTTP = new XMLHttpRequest();   
oHTTP.responseType = "arraybuffer";

The error

InvalidStateErr
An attempt was made to use an object that is not, or is no longer, usable

is thrown.

Is there another way to download binary data in a Firefox extension?

1 Answer 1

9

You must call the open method first.

4
  • Simple answer. But very helpful.
    – Temüjin
    Jan 19, 2015 at 5:23
  • 1
    But webkit-based, like latest Chrome or Opera stable (Feb 25th, 2015), don't give a sheit when I place xhr.open() somewhere after xhr.responseType = "arraybuffer". Why so?
    – spaffy
    Feb 25, 2015 at 20:03
  • @paa, @ spaffy, Is this a bug?
    – Pacerier
    Jul 27, 2015 at 4:15
  • how can I call open method first while using axios Mar 3, 2018 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.