How to specify that the target will be downloaded when a user clicks on the hyperlink in HTML?

HTMLWeb DevelopmentFront End Technology

Use the download attribute to set the file to download on click of the hyperlink. Set the value of the attribute to the name of the downloaded file, for example, image.

Example

<!DOCTYPE html>
<html>
   <body>
      <h3>if statement in Java</h3>
      <p>The following is an image explaining the concept if <b>if-statmement in Java</b> (Click to download):<p>
     
      <a href = "https://www.tutorialspoint.com/java/images/if_statement.jpg" download>
         <img border = "0" src = "https://www.tutorialspoint.com/java/images/if_statement.jpg" alt="Java" width="400" height="450">
      </a>
   </body>
</html>
raja
Published on 13-Mar-2018 16:48:43
Advertisements