Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda