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
Browser compatibility
| Desktop | Mobile |
|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet |
|---|
NavigatorOnLine | Chrome
Full support
1 | Edge
Full support
12 | Firefox
Full support
3.5 | IE
Full support
8 | Opera
Full support
3 | Safari
Full support
5 | WebView Android
Full support
1 | Chrome Android
Full support
18 | Firefox Android
Full support
4 | Opera Android
Full support
10.1 | Safari iOS
Full support
4.2 | Samsung Internet Android
Full support
1.0 |
|---|
onLine | Chrome
Full support
1-
Full support
1
- Notes 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.
| Edge
Full support
12 | Firefox
Full support
3.5-
Full support
3.5
- Notes Since Firefox 4 the browser returns
true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity. 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).
| IE
Full support
8-
Full support
8
- Notes 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.
| Opera
Full support
3-
Full support
3
- Notes From Opera 11.1 until Opera 12.1, the browser returns
true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity.
| Safari
Full support
5 | WebView Android
Full support
1-
Full support
1
- Notes Faulty in a WebView component, see Issue bug 16760.
| Chrome Android
Full support
18 | Firefox Android
Full support
4 | Opera Android
Full support
10.1-
Full support
10.1
- Notes From Opera 11.1 until Opera 12.1, the browser returns
true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity.
| Safari iOS
Full support
4.2 | Samsung Internet Android
Full support
1.0 |
|---|
| Available in workers | Chrome
?
| Edge
?
| Firefox
Full support
29 | IE
?
| Opera
?
| Safari
?
| WebView Android
?
| Chrome Android
Full support
29 | Firefox Android
Full support
35 | Opera Android
?
| Safari iOS
?
| Samsung Internet Android
Full support
2.0 |
|---|
Legend
-
Full support
- Full support
-
Compatibility unknown
- Compatibility unknown
- See implementation notes.
- See implementation notes.
See also