So, I'm trying to download binary files with javascript. It works fine on Chrome and Opera but doesn't work on IE.
After trying to download the files the warning "DOM7011: The code on this page disabled back and forward caching." appears on IE Developer Tools.
Does anyone already had this problem?
$.DownloadBase64File = function (file, data) {
if (file && data) {
var link = document.createElement('a');
link.setAttribute('href', "data:application/octet-stream;charset=utf-16le;base64," + encodeURIComponent(data));
link.setAttribute('download', file);
link.click();
};
};
if (data.status === '0') {
$.DownloadBase64File(
'MyPDF_File.pdf',
data.ReportBinary
);
}
Appretiate your help :)
So, I'm trying to download binary files with javascript. It works fine on Chrome and Opera but doesn't work on IE.
After trying to download the files the warning "DOM7011: The code on this page disabled back and forward caching." appears on IE Developer Tools.
Does anyone already had this problem?
$.DownloadBase64File = function (file, data) {
if (file && data) {
var link = document.createElement('a');
link.setAttribute('href', "data:application/octet-stream;charset=utf-16le;base64," + encodeURIComponent(data));
link.setAttribute('download', file);
link.click();
};
};
if (data.status === '0') {
$.DownloadBase64File(
'MyPDF_File.pdf',
data.ReportBinary
);
}
Appretiate your help :)
Share Improve this question edited Mar 5, 2018 at 16:29 Ricardo Cerdeira asked Mar 5, 2018 at 15:59 Ricardo CerdeiraRicardo Cerdeira 491 gold badge1 silver badge6 bronze badges 1- 1 @epascarello if only you knew the answer to my question... – Ricardo Cerdeira Commented Mar 6, 2018 at 15:10
1 Answer
Reset to default 1I've managed to solve my own problem and now I'll post the solution here to help others with the same problem.
I couldn't download files on IE. On other browsers like Chrome, Firefox and Opera was working fine. I searched a lot and even posted my problem here on StackOverflow although no one could help me find the answer.
I found this script that helped me.
The code is from dandavis and can be found here:
http://danml./download.html
https://github./rndme/download
Hope you can find it useful!