问题
I have a blob and want to download it. It works for Chrome, Firefox, IE10 and higher. The problem is IE9.
var isIE = /*@cc_on!@*/false || !!document.documentMode;
var blob = new Blob([data], {type: "application/pdf"});
if (isIE) {
window.navigator.msSaveOrOpenBlob(blob, "Download.pdf");
} else {
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "Download.pdf";
link.id = "TEST";
$('body').append(link);
document.getElementById("TEST").click();
}
Where is the problem? The IE has 2.083 as maximal limit for chars in URL. Maybe this is critical. What alternatives do I have? I have to support IE9... Thanks.
回答1:
As you can read here the Blob constructor is supported from IE version 10. You may want to use PDF.js.
来源:https://stackoverflow.com/questions/28196065/downloading-pdf-as-blob-with-js-in-ie9