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

102
Vistas
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 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