3

Hello JavaScripters,

I'm trying to download a blob file with type xlsx (excel) in Safari. I did this:

obReader = new FileReader();
obReader.onload = function(e) {
    obdata = btoa(obReader.result);
    obDatauri = 'data:' + isbContentType + ';base64,' + obdata;
    window.location = obDatauri; 
};
obReader.readAsBinaryString(iobBLOB);

This code above downloads pdf and txt files but when I use to download an excel file it doesn't works.

The var iobBLOB has the blob and isbContentType has the Content-Type, I have been used this ones:

  • application/vnd.ms-excel
  • application/force-download
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

and others seen in here


The Blob files has this type:

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Tested on a Macbook pro, Safari 9.03


Note: This code works on ChromeiOS and Safari (iPhone)

Thanks for the help!

Community
  • 1
  • 1
Es Noguera
  • 426
  • 1
  • 5
  • 19

0 Answers0