Mobile Web

HTML5 Browser state

This feature is supported in mobile applications only.

You can access information about the network connection state of the browser.

The navigator.onLine attribute returns false, if the browser cannot establish a connection to the network when a remote page is requested. To track the changes in the connection state, you must subscribe to the applicable events: online and offline. The events can be executed in the Window or WorkerGlobalScope object.

Table: Browser state attributes and events
Attribute or event Type Description

onLine

readonly Boolean

If the browser is connected to the network, this attribute returns true; otherwise false.

online

Event

When the return value of the onLine attribute changes from false to true, a connection is established and this event is triggered.

offline

Event

When the return value of the onLine attribute changes from true to false, a connection is lost and this event is triggered.

Note
The device can be connected to the network without access to the Internet.
Go to top