Home  >  Article  >  Web Front-end  >  In HTML, how to specify that the user downloads the target file when clicking a hyperlink?

In HTML, how to specify that the user downloads the target file when clicking a hyperlink?

王林
王林forward
2023-08-28 09:29:061235browse

In HTML, how to specify that the user downloads the target file when clicking a hyperlink?

Use the Download property to set the file to download when a hyperlink is clicked. Set the property value to the name of the downloaded file, such as 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"    style="max-width:90%"  style="max-width:90%">
      </a>
   </body>
</html>

The above is the detailed content of In HTML, how to specify that the user downloads the target file when clicking a hyperlink?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete