batchDownloadImages() {
const aTagDownload = [
{
download:'foo',
href:'a HD image's long base64 str comes from canvas.toDataUrl()'
},
{
download:'bar',
href:'a HD image's long base64 str comes from canvas.toDataUrl()'
}
]
const a = document.createElement('a');
aTagDownloadData.forEach((e) => {
a.setAttribute('download', `${e.download}.jpg`);
a.setAttribute('href', e.href);
a.click();
});
};
The method below can batch download images.
But when the HD image's size larger than a threshold value,its base64 string is too long so that a Tag's href attribute cannot hold the long base64 string.The final result is a failed download.
Long base64 image download failed
By the way, when I paste the long base64 string to Chrome's url bar,the tab broke.
Could anyone give me a solution to deal with the situation?
Thanks a lot.