Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

download images from http link in react

 1.const download = () => {
    var element = document.createElement("a");
    var file = new Blob(
      [
        "https://timesofindia.indiatimes.com/thumb/msid-70238371,imgsize-89579,width-400,resizemode-4/70238371.jpg"
      ],
      { type: "image/*" }
    );
    element.href = URL.createObjectURL(file);
    element.download = "image.jpg";
    element.click();
  };

2.<a href="img/me.jpg" download>
  <img src="img/me.jpg"/>
    </a>
//this won't download link only img from same folder
 
PREVIOUS NEXT
Tagged: #download #images #http #link #react
ADD COMMENT
Topic
Name
2+1 =