Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!