api.Navigator.onLine

Spec

MDN URL

Status

On the standards track: Yes

Is Experimental: No

Is Deprecated: No

Browser Support

In Chrome version 2 on 2009-05-21 Note: 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, macOS: 14, ChromeOS: 13, Linux: Always returns true. For history, see bug 40530968.

In Chrome Android version 18 on 2012-06-27

In Edge version 12 on 2015-07-29

In Firefox version 1.5 on 2005-11-29 Note: 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).

In Firefox for Android version 4 on 2011-03-29

In Internet Explorer version 4 on 1997-09-30 Note: 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.

Not in Node.js

In Quest Browser version 5.0 on undefined

In Opera version 3 on 1997-12-01 Note: 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.

In Opera Android version 10.1 on 2010-11-09 Note: 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.

In Safari version 4 on 2009-06-08

In Safari on iOS version 3.2 on 2010-04-03

In Samsung Internet version 1.0 on 2013-04-27

In WebView Android version 4.4 on 2013-12-09 Note: Can incorrectly return true, see bug 41369933.

In WebView on iOS version 3.2 on 2010-04-03