I am currently working on an extension that will allow users to download multiple files simultaneously. Using the Chrome downloads API along with AngularJS, here is the code snippet:
var fileDownloadProperties = function(raw) {
return {
url: "https:" + raw.url,
filename: sharedDir + "/" + raw.name + "pdf",
saveAs: false
}
};
$scope.status = "";
filesToDownload.forEach(function(raw) {
chrome.downloads.download(fileDownloadProperties(raw));
});
The issue I am facing is that the saveAs option is being ignored when the script runs, prompting the save as dialog to appear. This becomes cumbersome when downloading many files as each save dialog only opens after the previous file has finished downloading.
I have attempted to find a solution by using different methods, such as the code snippet below, but none have successfully prevented the save dialog from opening:
var a = document.createElement("a");
a.href = files[0];
a.download = files[0];
a.click();
If anyone has any suggestions on how to force Chrome to download files silently and simultaneously, I would greatly appreciate the help. Thank you.