I have a download operation in my javascript code with angularjs $http provider.
$http({
method: "POST",
url: "http://localhost:28494/api/print",
data: data,
responseType:'arraybuffer'
}).then(
function (response) {
var file = new Blob([response.data], {type: 'application/pdf'});
var objectUrl = URL.createObjectURL(file);
window.open(objectUrl,'_blank');
}
);
This fires my browser popup. I do not want to this.

But I want to download directly. Do not show the popup.
You should use window.location.assign(objectUrl);. This forces the window to open and display the url. In your case it will download the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With