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

171
Visualizações
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 Respostas
Responde à pergunta

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 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