Here is my download code:
var mimeType = this.getMime(obj);
var ab = this.base64ToArrayBuffer(obj[key]);
var blob = new Blob([ab.buffer], {
type : mimeType
});
var result = this.bintostring(blob);
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = result.filename;
a.target = '_blank';
a.click();
window.URL.revokeObjectURL(url);
During debugging, I do not see any exceptions.
For firefox appending the file to document has to be done. Firefox doesn't do it automatically unlike Chrome
a.download = result.filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With