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

144
Vistas
Javascript onunload not working when idle for a few minutes

I have a web page that calls a post request just before the user tries to exit the page. I am using the window.onbeforeunload event to achieve that. It works when I leave the page a few seconds after I enter the page, but it doesn't when I stay idle for a few minutes. Here's my Javascript:

window.onbeforeunload = function() {
  $.post('http://52.91.227.233:1000/set_day',
    {username: user, useday: day}
  );
};

According to my observation, there's no problem with the post request or the NodeJS app. It is a problem in the onbeforeunload event, though I don't know what exactly the problem is. I've also tried beforeunload but it still doesn't work

Thanks!

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