PageVisibility

@native @JSType
trait PageVisibility extends Object

The Page Visibility API lets you know when a webpage is visible or in focus. With tabbed browsing, there is a reasonable chance that any given webpage is in the background and thus not visible to the user. When the user minimizes the webpage or moves to another tab, the API sends a visibilitychange event regarding the visibility of the page. You can detect the event and perform some actions or behave differently. For example, if your web app is playing a video, it would pause the moment the user looks at another browser, and plays again when the user returns to the tab. The user does not lose their place in the video and can continue watching.

See also:
class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

def hidden: Boolean

Returns true if the page is in a state considered to be hidden to the user, and false otherwise.

Returns true if the page is in a state considered to be hidden to the user, and false otherwise.

Is a string denoting the visibility state of the document.

Is a string denoting the visibility state of the document.

Note: or a vendor prefixed DOMString as defined in 4.5 Vendor Prefixes

Inherited methods

def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object

Concrete fields

var visibilitychange: Function1[Event, _]

The visibilitychange event is fired when the content of a tab has become visible or has been hidden.

The visibilitychange event is fired when the content of a tab has become visible or has been hidden.