Page Visibility
Page visibility can detect whether the Web document is being shown on the screen. With it, you can design your application to only operate when its page is visible, both enhancing the user experience and reducing the resource usage on the device.
The main features of the Page Visibility API include:
- Retrieving the page visibility status
You can use 2 properties to detect the visibility status of the page:
The hidden property returns a boolean value indicating whether the page is visible.
The visibilityState property returns a DOMString type indicating whether the page is visible.
- Tracking changes in page visibility
You can use the visibilitychange event to be able to respond to changes in the page visibility status.
For example, in a video player application, you can change the play status of the application based on the event: pause the playback when the page becomes hidden, and continue playing when the page becomes visible again.
Note |
---|
Tizen supports the WebKit-based Page Visibility API. When using the Page Visibility API, you must include the webkit prefix. |