我试图在网页上下载图片,这很简单。但是,图像不以jpg / png结尾,它们是base64字符串。我将发布一个base64的例子和我试图编码的功能,使这个按钮下载..任何帮助将不胜感激...
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);
}