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
The beforeunload event was not triggered when not on the site's page

I have an event that needs to indicate if the user is_online or not. I'm using the beforeunload event, which triggering when the page is closed, and when it trigger I put the is_online property to false

Its works good when I close the page directly. However, when I skip to another tab in my browser and wait couple of minutes and then I close the page, this event didn't triggered and my user is_online status still appears as true.

this is the relevant code:

window.addEventListener(
    "beforeunload",
    async (event) => {
      event.stopImmediatePropagation();
      await set_user_is_online({value:false});
    },
    { once: true }
  );
about 4 years ago · Juan Pablo Isaza
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!