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

98
Views
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 answers
Answer question

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 Report

0

You can achieve this with the Page Visibility API

Answered here

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!