[whatwg] Proposal for a tab visibility API
bzbarsky at MIT.EDU
Wed Dec 8 11:57:51 PST 2010
On 12/8/10 2:47 PM, Alex Komoroske wrote:
> * A page wants to detect when it is moving into or out of the
> back-forward cache.
This is covered by pagehide/pageshow events, as you note; note that the
bfcache visibility state has some big differences from the other
"invisible" states, as currently implemented. Maybe we should be trying
to converge them, but I'm not convinced.
There are several issues we should keep in mind as we work on this:
1) "background tab" is pretty narrow. Minimized windows, windows that
aren't on the current desktop, etc, have all the same problems.
2) There is some potential for abuse (e.g. putting up dialogs to make
yourself the active tab if you determine that you aren't, though
perhaps this is a quality of implementation issue). I can
particularly see things like ads doing this so you don't just
switch to a different tab while they're running.
> A read-only property that returns a string, one of:
> * “visible” : the tab is focused in its window
And certain conditions in the window, ideally; though I can see leaving
that to a further iteration of the API.
> * “cache” : the tab is currently in the back-forward-cache. Note that
> in Mozilla’s current implementation, document.visibility would never
More information about the whatwg