Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
How do I force to download the mp3?

Im working on a simple download Webside, but instead od downloading the mp3 it is opened in the browser. How can I change this?

<!doctype html>
<head>

    <link rel="stylesheet" href="css\stylesheet.css">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Webseite</title>
    
</head>

<style>


</style>

<body>
    <h1>Test</h1>
    <p>Test
    </p>
    <a href="download\audio.mp3" download="audio.mp3" download="true">Download link</a>
</body>

Thanks for the help :)

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Your code works fine, but

  1. You don't need to use the download attribute twice, since most browsers will remove the last one.
  2. The download attribute only works if the file refers to the same domain. Due to security reasons, it will not be possible to download external files in modern browsers.

If you want the user to download an external file, you could manually or automatically download that file on your server and link it to the same domain. If you do, ensure that you are allowed to do this.

  • download only works for same-origin URLs, or the blob: and data: schemes.
  • If the Content-Disposition header has different information from the download attribute, resulting behavior may differ:
    • If the header specifies a filename, it takes priority over a filename specified in the download attribute.
    • If the header specifies a disposition of inline, Chrome, and Firefox 82 and later, prioritize the attribute and treat it as a download. Firefox versions before 82 prioritize the header and will display the content inline.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda