Internet, Networking, & Security Web Development Is There an HTML Download Tag? A download tag would allow HTML pages to force file downloads by Jennifer Kyrnin Freelance Contributor Jennifer Kyrnin is a professional web developer who assists others in learning web design, HTML, CSS, and XML. our editorial process LinkedIn Jennifer Kyrnin Updated on July 11, 2019 Hamza TArkkol / Getty Images Web Development CSS & HTML Web Design SQL Tweet Share Email If you're a web developer, you might be looking for HTML code that downloads a file—in other words, a particular HTML tag that forces the web browser to download a particular file instead of display it within the web browser. The only problem is that there isn't a download tag. You cannot use an HTML file to force a file download. When a hyperlink is clicked from a web page—no matter if it's a video, audio file, or another web page—the web browser automatically attempts to open the resource in the browser window. Anything that the browser doesn't understand how to load will be requested as a download instead. That is, unless the user has a browser add-on or extension that does load that particular file type. Some add-ons provide web browser support for all sorts of files like DOCX and PDF documents, some movie formats, and other file types. However, some other options will let your readers download files instead of open them in the browser. Educate Users on How to Use a Web Browser One of the easiest ways to have your users download files that might otherwise show up in their browser when clicked is to have them understand how file downloads actually work. Every modern browser has what's called a context menu that shows up when right-clicking a link, or when tapping-and-holding on touch screens. When a link is selected in this way, you have more options, like copying the hyperlink text, opening the link in a new tab, or downloading whatever file the link points to. This is a really easy way to avoid needing an HTML download tag: just have your users download the file directly. It works with every single file type, including pages like HTML/HTM, TXT, and PHP files, as well as movies (MP4s, MKVs, and AVIs), documents, audio files, archives, and more. The easiest way to emulate an HTML download tag is to tell people what to do, as in this example. Right-click the link and choose Save link as... to download the file. Some browsers might call this option something else, like Save As. Compress the Download to an Archive File Another method the website developer can use is to put the download in an archive like a ZIP, 7Z, or RAR file. This approach serves two purposes: it compresses the download to save disk space on the server and lets the user download the data quicker, but it also puts the file in a format that most web browsers will not attempt to read, which forces the browser to download the file instead. Most operating systems have a built-in program that can archive files like this, but third-party applications usually have more features and might be easier to use. PeaZip and 7-Zip are a couple of favorites. Trick the Browser With PHP Finally, if you know some PHP, you can use a simple five-line PHP script to force the browser to download the file without zipping it or asking your readers to do anything. This method relies on HTTP headers to tell the browser that the file is an attachment rather than a web document, so it, in fact, does work similarly to the method above but doesn't actually require you to compress the file.