0

I am trying to download the images, on a webpage, this is fairly simple. However, the images don't end with jpg/png they are base64 strings. I will post a example of the base64 and function I am trying to code to make this button download..any help would be appreciated...

iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==

function downloadPhotos() {
 // This code is part of my code for another project (Justin Baskaran)
   var images = document.getElementsByTagName('img');
   var srcList = [];
   var i = 0;

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

 }
hardillb
  • 54,545
  • 11
  • 67
  • 105
jewstin
  • 87
  • 1
  • 12

0 Answers0