There are a few answers to your question:
- You can use a few methods in emscripten.h such as
emscripten_async_wget
- You can write a method in Javascript yourself and call it from C++ https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html
but the kicker is that you can't easily make a synchronous call from XMLHttpRequest and get back binary data. Firefox OS will disallow that if the mime type specifies binary data. However, you can override the mime type and convert the resulting text into a typed array yourself. It's the same technique as the hack in this link.
At first glance this sounds like a perfect solution, but if you are receiving a lot of data back, you will have to convert that character array into a typearray and that is slow.