The online event is fired when the browser has gained access to the network and the value of navigator.onLine switched to true.

Note: That event shouldn't be used to determine the availability of a particular website. Network problems or firewalls might still prevent that website to be reached.
Bubbles No
Cancelable No
Interface Event
Event handler property ononline


window.addEventListener(‘online’, function(event){
    console.log("You are now connected to the network.");


Specification: HTML5 Online

Browser compatibility

No compatibility data found. Please contribute data for "api.Window.online_event" (depth: 1) to the MDN compatibility data repository.

See also

Document Tags and Contributors

Last updated by: irenesmith,