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

115
Views
Downloading a pdf without opening new tab or changing current tab view

I have a pdf I am receiving from an api call and I want to accomplish downloading the file to my computer without it opening a new tab or opening the url in the current tab I have open. I realize this is a question frequently asked but all I can find are examples accomplishing the opening new tab or loading in the current tab.

Ive tried using an tag like:

         <Button
              className="save-sign-note"
            >
              <a href={pdfURL} download={`${props.visitType}`}>
              Download and Next <RightArrow /> 
              </a>
            </Button>

and this downloads the file in the current window.

Also Ive tried using a handler like:

<Button
onClick={() => DowloadAndNext()}
>...

const DowloadAndNext = () => {
     window.location.href = pdfURL;
  };

and

<Button
onClick={() => DowloadAndNext()}
>...

const DowloadAndNext = () => {
    const url = pdfURL;
    const link = document.createElement("a");
    link.href = url;
    link.setAttribute("download", "file.pdf");
    document.body.appendChild(link);
    link.click();
  };

but I get the same result each time. Any help with this would be awesome as I am new to developing front end.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can’t control this from your website for pdf downloads. This is a browser settings behavior when downloading PDFs. Changing the default pdf software to Adobe reader instead of edge may solve this.

about 4 years ago · Juan Pablo Isaza 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!