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

100
Vistas
Message for Browser Tab

I want to add a message for example: If the user leaves the browser tab, the message "Looks like you're gone ..." should appear. When the user returns to the page, change the message to "Good to be back".

Is it possible to do something like this?

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

0

Crate an eventListener on your window, with the load event, and simply show an alert.

And create an event on your window called onbeforeunload (more info about the event), where you show an alert while leaving the page.

Note: onbeforeunload won't work in this snippet, but try putting inside your code.

window.addEventListener('load', (event) =>{

    alert("Looks like you are back");

});

window.onbeforeunload = function() {
          alert("Looks like you want to leave");
      };

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can achieve this with the Page Visibility API

Answered here

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