Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda