Answers for "javascript download image"

-1

javascript download image

var a = $("<a>").attr("href", "http://i.stack.imgur.com/L8rHf.png").attr("download", "img.png").appendTo("body");

a[0].click();

a.remove();
Posted by: Guest on April-28-2021
0

download image from url javascript

function download(source){
    const fileName = source.split('/').pop();
	var el = document.createElement("a");
	el.setAttribute("href", source);
	el.setAttribute("download", fileName);
	document.body.appendChild(el);
 	el.click();
	el.remove();
}
Posted by: Guest on September-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language