Download image in a URL

I have a QR in a URL

I want to click a button and download the image of the QR in the URL


is it possible using PHP or Javascript?

I havent figured it out.

>Solution :

You can use fetch to get the content as a blob, then create an <a> element with the download attribute. Clicking on the anchor will download the image.

fetch('').then(res => res.blob()).then(blob => {
    let url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url; = 'Image.png';;

Leave a Reply