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

Contact us

We’d love to hear from you! We’re not really all that evil, and we love discussing potential projects, intriguing ideas, and new opportunities. Complete the form below or drop us a line at

Martians at a glance
years in business

A product development consultancy that works with startups and established businesses, while also creating open source-based products and services