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

170
Views
¿Hay alguna manera de saber si el enlace a pdf no funcionará al hacer clic?

Tengo un enlace a.href que activa la URL que devuelve el PDF y lo muestra en una nueva pestaña.

¿Hay alguna manera de saber si ese enlace generará el pdf o funcionará?

Quiero mostrar un mensaje de error al usuario si la URL no funciona o no se genera un pdf.

¿Es eso posible?

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

0

Puede usar fetch para enviar una solicitud y obtener la respuesta y luego verificar si es una respuesta válida o no:

 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!