Home  >  Article  >  Web Front-end  >  An example of how to use href in HTML to pop up a file download dialog box when clicking a link

An example of how to use href in HTML to pop up a file download dialog box when clicking a link

高洛峰
高洛峰Original
2017-03-07 11:05:592684browse

Use href to implement file download. I didn’t know it before. Today I learned a trick to click the link to pop up the file download dialog box. Friends who are interested can learn more. I learned another trick today. I didn’t know it before, but I have done too few things...

Goal: Click the link to pop up the file download dialog box
Code:

The code is as follows:

<html> 
<head>代码下载</head> 
<title>代码下载</title> 
<body> 
<a href="Web.rar" >download</a> 
</body> 
</html>


If the browser supports the format that can be opened, it will open it directly online by default (such as word or picture). If the format is not supported, it will pop up a download prompt. It is best to make a file in .rar format

For more examples of how to use href in HTML to pop up a file download dialog box when clicking a link, please pay attention to the PHP Chinese website for related articles!

Statement:
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