For IE you can use navigator.msSaveOrOpenBlob
therefore, cross browser, the code will be
var strContent = "a,b,c\n1,2,3\n"; var HTML_APS = strContent; var data = new Blob([HTML_APS]); if (confirm("Press a button!") == true) { if (navigator.msSaveOrOpenBlob) { navigator.msSaveOrOpenBlob(data, "report_html.htm"); } else { var temp_link = document.createElement('a'); temp_link.href = URL.createObjectURL(data); temp_link.download = "report_html.htm"; temp_link.type = "text/html"; document.body.appendChild(temp_link); temp_link.click(); temp_link.remove(); } }
source share