Using the Page Visibility API

This page demonstrates the Page Visibility API.

The API can be used to check if a web page is visible.

When you minimise this page or move to another tab, a visibilitychange event is triggered. The video pauses and the page title stops changing – and vice versa if you return to the page.

Please note: this demo requires a browser such as Firefox or Google Chrome that supports the Page Visibility API.

For more information, please see my blog at

To detect element visibility (rather than page visibility) take a look at the jquery.inview plugin.