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

96
Visualizações
The beforeunload event was not triggered when not on the site's page

I have an event that needs to indicate if the user is_online or not. I'm using the beforeunload event, which triggering when the page is closed, and when it trigger I put the is_online property to false

Its works good when I close the page directly. However, when I skip to another tab in my browser and wait couple of minutes and then I close the page, this event didn't triggered and my user is_online status still appears as true.

this is the relevant code:

window.addEventListener(
    "beforeunload",
    async (event) => {
      event.stopImmediatePropagation();
      await set_user_is_online({value:false});
    },
    { once: true }
  );
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