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

王林
Release: 2023-08-28 09:29:06
forward
1223 people have browsed it

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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template