Home > Web Front-end > HTML Tutorial > Use href in html to pop up a file download dialog box when clicking a link

Use href in html to pop up a file download dialog box when clicking a link

不言
Release: 2018-05-08 14:49:46
Original
4640 people have browsed it

This article mainly introduces the use of href in HTML to realize the pop-up file download dialog box when clicking a link. It has certain reference value. Now I share it with you. Friends in need can refer to it.

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, interested friends can learn about it

I learned another trick today, I didn’t know it before, I just did it There are too few things...
Goal: Click on the link to pop up the file download dialog box
Code:

##Copy code

The code is as follows:

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

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

Related recommendations:

html The difference between empty link href="#" and href="javascript:void(0)"

The above is the detailed content of Use href in html to pop up a file download dialog box when clicking a link. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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