Visibility.js is a small JavaScript library that wraps the native Page Visibility API to give developers an easy interface for detecting when a user’s browser tab becomes visible, hidden, or is in prerendering mode. Its main purpose is to let web applications adapt behavior depending on whether the page is actually being viewed — for example, pausing animations, postponing heavy computations, or stopping unnecessary network requests when the user switches to another tab. The library hides browser vendor-prefixes and normalizes visibility events so you don’t have to manage cross-browser quirks yourself. On top of simple visibility detection, Visibility.js adds useful helpers such as a timer function that only runs when the page is visible. As a result, developers can write resource-conscious web apps that reduce CPU/bandwidth usage when the user isn’t actively viewing the page.

Features

  • Simple abstraction over the Page Visibility API with normalized events and states
  • Ability to run timers (every) only when the page is visible, saving resources when hidden
  • Callbacks like onVisible, onHidden, change to execute logic on visibility state changes
  • Fallback mode using focus/blur events for browsers lacking native Page Visibility support
  • Easy installation via npm and straightforward API usage for web developers
  • MIT-licensed and sufficiently lightweight for inclusion in most web apps

Project Samples

Project Activity

See All Activity >

Categories

Browsers

License

MIT License

Follow Visibility.js

Visibility.js Web Site

Other Useful Business Software
Earn up to 15% annual interest with Nexo. Icon
Earn up to 15% annual interest with Nexo.

More flexibility. More control.

Generate interest, access liquidity without selling, and execute trades seamlessly. All in one platform. Geographic restrictions, eligibility, and terms apply.
Get started with Nexo.
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Visibility.js!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

JavaScript

Related Categories

JavaScript Browsers

Registered

2025-11-27