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

230
Vistas
How to programmatically get reason for why a script resource failed to load

I am creating and attaching a script tag dynamically in a script. Along with that I am adding an onerror handler. However, when the script fails to load I don't get any details as to why it failed. I would expect some details about script not available (a 404) , or timeout or anything else useful. Any way to get that information ? Note that I need to get the data programmatically so I can send it to Sentry. It’s for debugging user errors and I may not have access to their browsers and dev tools

const newScriptElement = document.createElement('script');
newScriptElement.src = url;
newScriptElement.type = 'text/javascript';
newScriptElement.async = true;
newScriptElement.id = scriptId;
newScriptElement.onerror = (ev) => {
   console.log(ev.message); // <-- The message property doesn't exist. But also no other message like property 
};
document.head.appendChild(newScriptElement);

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