W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2010

[whatwg] Proposal for a tab visibility API

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 08 Dec 2010 14:57:51 -0500
Message-ID: <4CFFE33F.9040302@mit.edu>
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
> actually be ?cache? because Javascript cannot execute when in the cache.

Yes, but javascript running in other windows can touch the cached JS 
objects, no?

Received on Wednesday, 8 December 2010 11:57:51 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:28 UTC