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

97
Views
visibilitychange fires when page gets reloaded or navigated to other page
  document.addEventListener("visibilitychange", onVisibilityChange, {
    passive: true,
  });

This will fire even when someone navigates away from my page. Ofcourse this is logical. But is there a way to check if someone navigates away?

Edit: What i want is to listen if the user switches to another tab or places the window in the background. this work with visibilityChange but it also fires when the user reloads the page or navigates back and forth in the history. But this is behaviour when i don't want to fire the event

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!