function downloadImage(imageUrl) { const link = document.createElement('a'); link.href = imageUrl; link.download = imageUrl.split('/').pop(); document.body.appendChild(link); link.click(); document.body.removeChild(link); }