Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda