Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native only 1 corner rounded 
Javascript :: javascript getcontext 
Javascript :: bootstap jquery 
Javascript :: js bubble sort 
Javascript :: javascript get last object in foreach loop 
Javascript :: jquery get 2nd child 
Javascript :: express post method 
Javascript :: js hexadecimal 
Javascript :: Create MD5 hash with Node.js 
Javascript :: Summernote keyup event jquery 
Javascript :: javasript document referrer 
Javascript :: shorthand if statment in js 
Javascript :: jquery parent 
Javascript :: repeat an element in array in js 
Javascript :: js copy array into another 
Javascript :: react blur background 
Javascript :: how to find last element in array in javascript 
Javascript :: str replace javascript all 
Javascript :: sort arrays according to first array js 
Javascript :: how to find date in a string js 
Javascript :: get current file name javascript 
Javascript :: variable for every user discord.js 
Javascript :: how to appendChild in the begin of the div javascript 
Javascript :: reactjs node sass incompatible with ^4.0.0 ^5.0.0 
Javascript :: add dark mode to react 
Javascript :: react-active link 
Javascript :: json load 
Javascript :: reverse text javascript 
Javascript :: js add a tag inside span 
Javascript :: continue foreach javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =