Download PDF file from api using javascript IE9
问题 I use angular 1.5 to get a PDF file from an API. Here is my code : $http.get('http://www.example.com/pdf.php') .then(function(response) { if (response) { // get pdf try { var isFileSaverSupported = !!new Blob; var blob = new Blob([response.data], {type: "application/pdf;charset=utf-8"}); FileSaver.saveAs(blob, "Test file.pdf"); } catch (e) { var w = window.open(); var doc = w.document; doc.open( 'application/pdf','replace'); doc.charset = "utf-8"; doc.write(response.data); doc.close(); doc