Blob pdf in <embed> not working in IE

I am working on a corner application. On one of the pages I need to display a pdf file. therefore, this is what I have tried.

in the controller:

$http.get('http://localhost:3030/getpdf/1234', {
    responseType: 'arraybuffer'
}).success(function(data, status, headers, config) {
    var blob = new Blob([data], {
        type: "application/pdf"
    });
    var objectUrl = URL.createObjectURL(blob);
    $scope.src = objectUrl;
    $('.pdfembed').html('<embed src="' + $scope.src + '" type="application/pdf" width="60%" height="600px"></embed>');
}); 

in partial template:

<div class="pdfembed"></div>

This method works in Chrome, Firefox. But not in IE.

I am not sure the problem is in IE or Adobe Reader. So confused.

Any idea how to fix this?

Thanks in advance.

+4
source share

All Articles