I am trying to download multiple files from multiple URL's using javascript so far I have tried multiple options but it works only for 1 URL.
I have an array of URL's that needs to start multiple downloaded in the browser.
$(fileUrls).each(function(_index, fileUrl: any) {
let tempElement: any;
tempElement = document.createElement("A");
tempElement.href = fileUrl;
tempElement.download = fileUrl.substr(fileUrl.lastIndexOf("/") + 1);
document.body.appendChild(tempElement);
tempElement.click();
document.body.removeChild(tempElement);
});
Also tried using
$(fileUrls).each(function (_index, fileUrl: any) {
window.location.href = fileUrl;
});
But it works for only 1 URL rest of the calls fails with below warning message in the browser
Resource interpreted as Document but transferred with MIME type application/octet-stream