It is necessary to make a function that the file loader is called from the code. That is, a list of paths is passed and the browser starts downloading them. Example 1: downloadFiles([ "/1.jpg", "/2.jpg", "/3.jpg" ])
the function itself is in the outline (though only for one file)
function donwloadFiles(url, sourceElement) {
disableOnUnloadPage = true;
var a = document.createElement("a");
a.href = url;
if (sourceElement) {
a.target = sourceElement.target;
}
dojo.body().appendChild(a);
a.click();
disableOnUnloadPage = false;
}
If you run several files at once like this, they are not downloaded. The browser has some internal logic that does not allow this to be done.
How to remove SourceElement and make it accept an array of links as in example 1.
You can't.
Browsers do not let webpages spawn multiple windows or downloads.
It would be too abusable.