I have a local DB table in which many PDF links are saved around 15000. I want to download all that PDF on one click but my problem is its opening PDF not downloading. I was trying this method.
items = Array.from(document.getElementsByTagName("a"));
items.forEach(function(item) {
    link = item.href;
    if (link.substr(link.length - 4) == ".pdf") {
        filename = link.replace(/^.*[\\\/]/, '');
        item.download = filename;
        item.click();
    }
});