Firefox 20 Nightly Adds Unprefixed Page Visibility API, Following Opera

The API enables pages to check whether they are visible in the browser

The latest Firefox Nightly builds now come with the Page Visibility API unprefixed. What this means is that as of Firefox 20, web pages can be sure that the API works as intended in Mozilla's browser.

With the web becoming more and more capable, web apps are becoming more powerful, which means more resource hungry.

Basically, all computers today are more than capable of handling most HTML5 games or snazzy email app, but if you start to pile them things slow down fast.

Multitasking is an even bigger issue for a browser than it is for desktop operating systems.

But browsers aren't necessarily built with multi-tasking in mind, simply because up until recently, most users haven’t really run into performance problems even with a lot of open tabs.

Modern browsers take this into account, but it's becoming important for web apps to do the same. One simple way of ensuring tabs that aren't used don't hot all the resources is via the Page Visibility API.

As the name implies, the API can be used to determine whether a certain page is visible to the user or not, i.e. if it's in a background tab or window.

This comes in handy in a number of cases, not just when performance is important. Obviously, apps like games can use it to stop rendering 3D content or better yet pause the game when the user switches to another tab.

But there are plenty of other uses, a photo sharing website could use the Page Visibility API to pause an image slideshow, web pages that constantly pull data and info from a server can pause this when no one is there to see the updates.

Also useful is for pre-rendering. For example, Chrome pre-renders pages that it believes users are very likely to open next. This ensures that many of the page's assets are already loaded when the user clicks on the link.

But it can also lead to problems for websites that may count this as a visit even if Chrome makes an error and the user doesn't actually open that page. The Page Visibility API fixes this.

Page Visibility is supported by most modern browsers. Opera became the first to support the unprefixed version of the API, in Opera 12.10 only a short while ago, albeit not all features are working.

Firefox now also supports the unprefixed version, though only in the Nightly channel. You'll have to use the prefixed versions for WebKit browsers and Internet Explorer.

Hot right now  ·  Latest news