Hi,
Previously the pdf downloaded in the same tab ,but my requirement is that view the pdf in other tab and then download the pdf.I am able to view the pdf in another tab,but when i am clicking the download icon of the pdf then it shows network error.The pdf url coming as a blob format.
function sectionPdfGeneration() {
var deferred = $.Deferred();
var sectionName = sectionPdfName;
var blob = convertSectionBase64ToBlob(pdfSectionData);
if (typeof window.navigator.msSaveBlob !== 'undefined') {
// IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
window.navigator.msSaveBlob(blob, sectionPdfName+'.pdf');
} else {
var URL = window.URL || window.webkitURL;
var downloadUrl =window.URL.createObjectURL(blob);
if (sectionName) {
// use HTML5 a[download] attribute to specify sectionName
var a = document.createElement("a");
// safari doesn't support this yet
if (typeof a.download === 'undefined') {
window.location = downloadUrl;
} else {
//a.href = downloadUrl;
//a.download = sectionName;
//document.body.appendChild(a);
//a.click();
window.open(downloadUrl,'_blank');
}
} else {
window.open(downloadUrl,'_blank');
}
// cleanup
setTimeout(function () {
URL.revokeObjectURL(downloadUrl);
$('body').children('a[download]').remove();
}, 100);
}
deferred.resolve();
return deferred.promise();
}
PFA the my code.any help would be appreciated.