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

189
Visualizações
JavaScript Blob not working on mobile browser

I have some problems with Blob. I have a website running on Vue 3, and there is one action that is downloading pdf from the backend, but it's not working from mobile browser. It's actually working from the mobile browser, but we have another browser that is opening (just like when you click on facebook url it's opening in their own browser). So every time when I try to download it from that browser it fails. What am I doing wrong?

async function downloadPdfLink(args: IPaymentDownloadPDFArguments): Promise<void> {
    isPDFLoading.value = true;

    return get('/users/' + args.userId + '/payments/' + args.paymentId + '/download-pdf', {
      responseType: 'arraybuffer'
    }).then((response) => {
      const blob = new Blob(
          [response.data],
          { type: 'application/pdf' }
        )
      const url = window.URL.createObjectURL(blob);
      const link = document.createElement('a');
      const name = convertToKebabCase(args.name) + moment(new Date()).format("_YYYY_DD_MM");
      link.href = url;
      link.setAttribute('download', name + '.pdf');
      document.body.appendChild(link);
      link.click();
    })
      .catch((reason) => {
        throw new Error(reason)
      })
      .finally(() => {
        isPDFLoading.value = false;
      })

  }

btw I'm not really able to debug it from that browser.

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