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

201
Vistas
how to triger some func when session destroy by closing browser in JS?

I am trying to catch moment when browser is closed by visitor. With window.beforeunload it works perfect for pc users with needed browsers for me. However, I am detecting mobile users with "visibilitychange". It works in some browsers but in safari and chrome with some mobile devices cannot catch when browser closes. After research I couldnt find any way except session. Although I am not sure if this is solution. Is there any way to trigger function when session ends by closing browser ? Or is there better way to handle this problem?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

An almost cross-working example with beforeunload:

window.addEventListener("beforeunload", function (e) {
  var confirmationMessage = "\o/";

  (e || window.event).returnValue = confirmationMessage; //Gecko + IE
  return confirmationMessage;                            //Webkit, Safari, Chrome
});

more details on : MDN Documentation

about 4 years ago · Juan Pablo Isaza Denunciar
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