Online status
Widely available
The navigator.onLine
property returns a Boolean for whether the browser is connected to some network (though not necessarily the internet). The online
and offline
events fire when the connection state changes.
To learn more, see
Navigator: onLine property,
Window: offline event,
Window: online event,
WorkerGlobalScope: offline event,
WorkerGlobalScope: online event,
WorkerNavigator: onLine property at MDN.
Compatibility (view on caniuse.com)
- Chrome 2 Released on 2009-05-21
- Chrome Android 18 Released on 2012-06-27
- Edge 12 Released on 2015-07-29
- Firefox 1.5 Released on 2005-11-29
- Firefox for Android 4 Released on 2011-03-29
- Safari 4 Released on 2009-06-08
- Safari on iOS 3.2 Released on 2010-04-03
Specifications
- HTML Standard (#navigator.online), from HTML Workstream (WHATWG).
- HTML Standard (#event-online), from HTML Workstream (WHATWG).