The NavigatorOnLine interface contains methods and properties related to the connectivity status of the browser.

There is no object of type NavigatorOnLine, but other interfaces, like Navigator or WorkerNavigator, implement it.

Properties

The NavigatorOnLine interface doesn't inherit any property.

NavigatorOnLine.onLine Read only
Returns a Boolean indicating whether the browser is working online.

Methods

The NavigatorOnLine interface neither implements, nor inherit any method.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'NavigatorOnLine' in that specification.
Living Standard No change from the latest snapshot, HTML5
HTML5
The definition of 'NavigatorOnLine' in that specification.
Recommendation Snapshot of HTML Living Standard with its initial specification.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes ? Yes Yes Yes Yes
Support on WorkerNavigator ? ?29 ? ? ?
onLine Yes1 Yes

3.52

43

84 No55
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes ? Yes Yes Yes ?
Support on WorkerNavigator ?29 ?35 ? ? ?
onLine Yes6 Yes Yes4 ? ? ?

1. Earlier versions of Chrome incorrectly return true when a tab is first opened, but it starts reporting the correct connectivity status after the first network event. Windows: 11, Mac: 14, Chrome OS: 13, Linux: Always returns true. For history, see crbug.com/7469.

2. Since Firefox 4 the browser returns true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity.

3. Since Firefox 41, on OS X and Windows, the returned values follow the actual network connectivity, unless 'Work offline' mode is selected (where it will always return false).

4. in Internet Explorer 8 'online' and 'offline' events are raised on the document.body; under IE 9 they are raised on both document.body and window.

5. Since Opera 11.10, the browser returns true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity.

6. Faulty in a WebView component, see Issue bug 16760.

See also

Document Tags and Contributors

Tags: 
Contributors to this page: fscholz, chrisdavidmills, abbycar, teoli
Last updated by: fscholz,