I want to download image from website and that image is located to a different website. I specified image's url but it's not downloading. It just opens the picture itself in its original page but only image is displayed. I can't identify the problem. Here's my code:
document.querySelector("#memeDownload").addEventListener("click", function () {
var a = $("<a>").attr("href", "https://iynmemes.netlify.app/images_memes/meme0.jpg").attr("download", "Meme(IYN").appendTo("body");
a[0].click();
a.remove();
});