Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67556

Trying to download all of the images on the website using javascript

$
0
0

I need some help with this script that I'm trying to make that downloads all of the images on a webpage. It downloads the first image just fine, then when Google Chrome tries to download the rest of them, it says "No File". Some help would be greatly appreciated. I run this code by pasting it into the javascript console. Thanks!

var images = document.getElementsByTagName('img');
var srcList = [];
var i = 0;

setInterval(function(){
    if(images.length > i){
        srcList.push(images[i].src);
        var link = document.createElement("a");
        link.id=i;
        link.download = srcList;
        link.href = srcList;
        link.click();
        i++;
    }
},1500);

Viewing all articles
Browse latest Browse all 67556

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>