Visibility.js logo

Services & Skills

Share on

Visibility.js is a wrapper for the Page Visibility API. It hides vendor prefixes and adds high-level functions.

Page Visibility API allows you to determine whether your web page is either visible to a user or hidden in the background tab or prerendering. It allows you to use the page visibility state in JavaScript logic and improve browser performance by disabling unnecessary timers and AJAX requests, or improve user interface experience (for example, by stopping video playback or slideshow when the user switches to another browser tab).

Moreover, you can detect if the browser is just prerendering the page while the user has still not opened the link, and don’t count this as a visit in your analytics module, or do not run heavy calculations or other actions which will disable the prerendering.

Page Visibility API is natively supported by all browsers. For old browsers, you can use lib/visibility.fallback.js with focus/blur hack (note that this hack has an issue: when the browser has just lost focus, but is still visible for the user, its state will change to [hidden]).


In the same orbit

Explore more open source projects

How can we help you?

Martians at a glance
years in business

We transform growth-stage startups into unicorns, build developer tools, and create open source products.

If you prefer email, write to us at