I have the following code working fine in Chrome and IE. User clicks on an anchor tag and the code gets executed after which a pdf file is rendered in a new tab with the url blob:http://localhost:57389/5aee262a-8bc9-4943-b67f-7b76aeef4b99
vme.loadAttachment = function (attachment) {
taskService.getAttachmentContent(attachment.Name)
.then(function (response) {
var file = new Blob([response], { type: attachment.Type });
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(file);
}
else {
var objectUrl = URL.createObjectURL(file);
window.open($sce.trustAsResourceUrl(objectUrl), _blank");
}
})
};
However on Firefox, the new tab is opened but closes immediately on its own. Any idea what could be causing this?
This thing happened to me today. I have several different VM snapshots that I use to test different "clients", and I got two of these where PDF would not open - the browser briefly flashed and the PDF did not appear.
In the end, it was an ad blocker (ABP). Simply telling it to ignore the website domain allowed PDFs to appear correctly.
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