2 | | it seems direct "blob" response is not yet supported by all browser (chrome don't) but we can easily build it from arraybuffer:[[BR]] |
3 | | |
4 | | var xhr=new XMLHttpRequest();[[BR]] |
5 | | xhr.open("GET",url,true);[[BR]] |
6 | | xhr.responseType="arraybuffer";[[BR]] |
7 | | xhr.onload=function(){[[BR]] |
8 | | if (this.status==200){[[BR]] |
9 | | var bb=new BlobBuilder();[[BR]] |
10 | | bb.append(this.response);[[BR]] |
11 | | var blob=bb.getBlob());[[BR]] |
12 | | ...[[BR]] |
13 | | }[[BR]] |
14 | | };[[BR]] |
| 2 | it seems direct "blob" response is not yet supported by all browser (chrome don't) but we can easily build it from arraybuffer: |
| 3 | {{{#!js |
| 4 | var xhr=new XMLHttpRequest(); |
| 5 | xhr.open("GET",url,true); |
| 6 | xhr.responseType="arraybuffer"; |
| 7 | xhr.onload=function(){ |
| 8 | if (this.status==200){ |
| 9 | var bb=new BlobBuilder(); |
| 10 | bb.append(this.response); |
| 11 | var blob=bb.getBlob()); |
| 12 | //... |
| 13 | } |
| 14 | }; |