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

181
Views
Is there a way to know does Link to pdf will not work on click?

I have a.href link that triggers the URL which returns the PDF and displays it in a new tab.

Is there a way to know does that link will generate the pdf or will work?

I want to display an error message to the user if the URL does not work or a pdf is not generated.

Is that possible?

      <a
        href={URL}
        rel="noopener noreferrer"
        target="_blank"
        download
      >
        PDF DOCUMENT
      </a>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use fetch to send request and get the response and then check to see it is a valid response or not:

const requestOptions = {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ id: 'fileId'})
    };
fetch('https://reqres.in/api/posts', requestOptions)
    .then(response => response.json())
    .then(data => {
         //here check to see data is valid or not
   });
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!