Podczas próby wywołania tagu .click()
znacznika anchor
do adresu URL auto click
. Kod działa poprawnie we wszystkich przeglądarkach z wyjątkiem Internet Explorer
v11..click() z odmową dostępu w IE11
Każda pomoc zostanie doceniona.
var strContent = "a,b,c\n1,2,3\n";
var HTML_APS = strContent;
var data = new Blob([HTML_APS]);
var temp_link = document.createElement('a');
temp_link.href = URL.createObjectURL(data);
temp_link.download = "report_html.htm";
temp_link.type = "text/html";
temp_link.style = "display:none";
document.body.appendChild(temp_link);
if (confirm("Press a button!") == true) {
temp_link.click();
temp_link.remove();
}
Tutaj jest fiddle.
dla IE, użyj 'navigator.msSaveOrOpenBlob' - https://jsfiddle.net/ hcqn9m5a/3/ –
Nie ma tu kodu jQuery, dlaczego masz ten tag? – Barmar