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

143
Vistas
onunload and pagehide event not firing after refresh

I have a 2 page application, where one is a parent page which opens the second page using window.open(url). I am watching for onunload or pagehide event from the child page. Both events are fired for the first time when child page opens(as expected) then when I refresh the child page the events are fired again but after that on close or refresh none of the events are triggered. Here is a sample code:

parent page

const newWindow = window.open(url);
newWindow.onunload = () => console.log('Unload event fired');
newWindow.onpagehide = () => console.log('PageHide event fired');

Both onunload & onpagehide events are recorded till first refresh of the child page. After refresh, If I try to refresh the page again or close the tab none of the event is recorded.

Here I am refreshing the child page which window.open opens. Also the url domain for both parent and child are same.

Am I doing something wrong here?

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