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

146
Vistas
Javascript: Trigger event before a lazily loaded image gets requested by the browser

I like to display lazy loaded images in my web-app using loading="lazy". The problem I have is that the client needs to have a time limited token to request images from the server.

If an image scrolls onto the viewport, the client needs to request a token and with this token the client can request the image. For doing so, I need some kind of event or trigger to be fired before the lazy loaded image is requested by the browser.
I can not send the token with the first page hit or somewhere inbetween because I do not know how long the user is visiting other parts of the app before the images get visible. The time varies between some seconds and hours.

<img onload="doStuff()" /> gets fired after the image has been loaded. This is too late. I need something before the image is requested.

I'm not bounded to use images or loading="lazy" to resolve this issue. Any workaround is also welcome.

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