Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
¿Chrome no activa el evento "onerror" para la etiqueta "enlace"?

Estoy actualizando el sistema de tematización de un sitio web y trato de manejar cuando un elemento <link rel="stylesheet"> no puede cargar un tema para que pueda volver a un tema predeterminado (así como para identificar selección de temas, etc.).

En Firefox, puedo usar el evento "onerror" a través de jQuery antes de configurar el atributo href , por ejemplo, $("#myLinkElement").one("error", handleThemeLoadError).attr("href", themeUrl) .

Si themeUrl hace referencia a un archivo CSS que no existe (lo que da como resultado un 404), se llama a handleThemeLoadError .

En Chrome, sin embargo, el evento onerror nunca se dispara. Veo el error 404 en las pestañas de la consola y la red, y Chrome incluso me muestra la línea de código donde se establece el atributo que causó el error 404, pero no activará un evento de error. Incluso probé $("#myLinkElement").get(0).onerror = function() { ... } , y también intenté configurar el atributo href en null e undefined antes de configurarlo en la URL real .

¿Hay alguna otra forma de detectar errores de carga de hojas de estilo en Chrome, o no tengo suerte?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!