

Visibility API for browser tabs/windows - chris_wot
https://github.com/ai/visibility.js

======
tommi
"improve user interface experience (for example, by stopping video playback or
slideshow when user switches to another browser tab)."

In general, please don't do that. I might want to listen to the video or check
and save a reference from the video in an another browser window. I think
there are many uses cases where this kind of automation, especially without
ability to disable it, actually hinders usability.

~~~
TazeTSchnitzel
I agree. This is something that bothers me in Windows 8: the fact applications
have to "pause" when they run in the background. Unfortunately, this prevents
you from listening to music in a YouTube video without having the browser on-
screen.

------
philbo
I wonder how much global warming can be accounted for by CPU cycles spent
needlessly executing instructions from undisplayed web pages? If every website
started using the Page Visibility API, we could save the planet!

This library looks good, the high-level timer and initialiser stuff is a nice
abstraction.

~~~
loceng
It's likely more the method of energy generation for powering computers that
is potentially (probably) contributing to pollution, which would be affecting
global warming than the actual heat accounted for by CPUs..

------
taitems
You can hack up something similar with the idleTimer plugin, modified by Paul
Irish.

<http://paulirish.com/2009/jquery-idletimer-plugin/>

------
bhauer
Thanks for this! I was looking for something similar just a week ago.

------
voxx
this is pretty cool. very practical for advertising purposes and things like
that.

~~~
chris_wot
Not to mention that it helps stop Firefox from using up all your battery life!
:-)

~~~
voxx
Now that's really something. A simple javascript saving battery life. You've
done a super job here

~~~
chris_wot
Oh man... I just realised that folks might think that _I_ created this! I
didn't - I thought it was awesome so I posted it up here. Sorry if I misled
anyone...

