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

128
Visualizações
How to have a link trigger both a file download and take me to a new page?

I am trying to set up my website to download a file when a user clicks a specific link and then also take them to a separate page. From what I have gathered, this is not possible using pure HTML since we can't chain A tags together. Is this understanding correct? If so, how would I approach doing this in Javascript?

For context, I am trying to mimic the behavior on this site: https://code.visualstudio.com/download when you click the download VS Code button.

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

0

I can think of two ways to do this.

  1. You can handle all that in an event listener function for the download button to open a new location and also open a file link (to trigger download).

  2. You can handle it that an event listener opens a new link then triggers download with window.onload or window.contentLoaded.

about 4 years ago · Santiago Gelvez 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