Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
Mensaje para la pestaña del navegador

Quiero agregar un mensaje, por ejemplo: si el usuario sale de la pestaña del navegador, debería aparecer el mensaje "Parece que te has ido ...". Cuando el usuario regrese a la página, cambie el mensaje a "Es bueno estar de vuelta".

¿Es posible hacer algo como esto?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Cree un eventListener en su ventana, con el evento de load , y simplemente muestre una alerta.

Y cree un evento en su window llamado onbeforeunload ( más información sobre el evento) , donde muestra una alerta al salir de la página.

Nota: onbeforeunload no funcionará en este fragmento, pero intente ingresar su código.

 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 Report

0

Puede lograr esto con la API de visibilidad de página

Respondido aquí

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!