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

303
Vistas
React cannot download blob data through anchor tag on Chrome
const response = await axios({
  ...
})

if (response && response.status == 200) {
   const url = window.URL.createObjectURL(
      new Blob([response.data], { type: 'text/plain' }),
   )
}
setState({
  ...state,
  fileLink: url,
})

JSX

{state.fileLink && (
  <p>
    Click{' '}
    <a
      href={`${state.fileLink}`}
      target="_blank"
      download="file.txt"
      rel="noreferrer"
    >
      here
    </a>{' '}
    to download your file
  </p>
)}

The flow is: The user clicks on a button which sends request to server. The server sends back txt data to the browser. The js then creates a blob from the response data and points the a href to the blob url.

I can see the response data as well as the blob url.

However, when the a tag is clicked, I get ERR_FILE_NOT_FOUND. (I have disabled Ad blocker as was suggested in another thread)

The full error in Chrome is:

Your file couldn’t be accessedIt may have been moved, edited, or deleted. ERR_FILE_NOT_FOUND

The error in Firefox is:

Uncaught Error: Access to 'blob:https:..' from script denied

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