Skip to content Skip to sidebar Skip to footer

Download File In Ie11

I create a application in which draw details on a chart by using JSON. and then save that chart as png/pdf. For this my code is - function ExportPdfAndSaveChart(id, title, type, d

Solution 1:

I stumbled with a similar issue (with PDF files, in my case), and solved it like this:

$http.get('/webclientes/api/policies/getPlanFile/OLAS&&CG247S2501.pdf', {

    $http.get('/webclientes/api/policies/getPlanFile/'+datos, {
    responseType: 'blob'
    })
    .success(function(data, response) {

        vm.errorNoExistePDF = true;
        var file = new Blob([data], {
        type: 'application/pdf'
        });
        var fileURL = URL.createObjectURL(file);

        if ($window.navigator && $window.navigator.msSaveOrOpenBlob) {

            $window.navigator.msSaveOrOpenBlob(file);
        }else$window.open(fileURL);
        })
    .error (function(data){
        console.log("ERROR");
        vm.errorNoExistePDF = true;
    });
});

Pay attention to this bit:

if ($window.navigator && $window.navigator.msSaveOrOpenBlob) {

            $window.navigator.msSaveOrOpenBlob(file);

Post a Comment for "Download File In Ie11"