Question: I have a list of URLS of media (photos + videos) i want to download.

Of course, i can dump the file into wget but i was thinking if it was posible to do it client-side.

My node.js server can inject the client with the resources in the form an link.
Then i found this website on how to download the link
<https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server>

The problem is that the user will have to click each resource to download it, which is extremely time consuming. I would rather use wget than that.

I believe that for security concerns auto downloading is not supported.

But is there a way to automatically download all the resources without user interface?

Kinda like, the server keeps serving the URL resources, the client auto downloads them, until no more resources are left to serve.

EDIT: Or maybe, with one click of a button, instead of downloading one resource, loop and download through all of them

Answer: 
you can make an onclick event for a link;

```
<a onclick="specialOnClick">download ALL</a>

<script>
function specialOnClick() {

   window.open('mysite.com/file1');
    window.open('mysite.com/file2');
    window.open('mysite.com/file3');
}
</script>

```
ES6 version
===========

```js

const autoDownloadFile = (href = ``, title = ``) => {
    const a = document.createElement("a");
    a.setAttribute("href", href);
    a.setAttribute("download", title);
    a.setAttribute("target", "_blank");
    a.click();
};

// autoDownloadFile(`https://cdn.xgqfrms.xyz/logo/icon.png`, `icon`);

```

```js
const autoDownloadFile = (href = ``, title = ``) => {
    const a = document.createElement("a");
    a.setAttribute("href", href);
    a.setAttribute("download", title);
    a.setAttribute("target", "_blank");
    a.click();
};

autoDownloadFile(`https://cdn.xgqfrms.xyz/logo/icon.png`, `icon`);
```