Direct download without playback

Asked

Viewed 2,126 times

1

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

OBS: Chrome latest 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>
  • Do you control the server where these files are hosted? If so, you know which server?

  • @ctgPi, No control.

1 answer

2


If you do not control the server, the solution is to use the attribute download="…" 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 on Chrome and Firefox, but does not work on any IE version.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.