Direct download without playback

1

I have an HTML file where there are some download links, but some links are not downloading themselves but opening in the browser itself, such as .txt and .mp3 files, files like .rar and .zip are downloaded directly, like do I make sure all files are downloaded directly (not being played)?

OBS: Chrome last version.

        <html>
       <head>
           <title>
                    Downloads
           </title>
         </head>
        <body>
            <a href="teste.txt">TXT</a>
            <a href="teste.rar">RAR</a>
            <a href="teste.mp3">MP3</a>
        </body>
</html>
    
asked by anonymous 07.06.2015 / 03:51

1 answer

2

If you do not control the server, the solution is to use attribute download="…" of HTML5:

<a href="teste.txt" download="laranja.txt">TXT</a>
<a href="teste.rar" download="morango.rar">RAR</a>
<a href="teste.mp3" download="banana.mp3">MP3</a>

This works in Chrome and Firefox, but does not work in any version of IE.

    
07.06.2015 / 03:56