1. Home
  2. Javascript
  3. Offline online network

Add event listeners for checking the network status. Capturing those events lets you handle offline and online status of the application.

#javascript
window.addEventListener('online', ()=> console.log("online"));
window.addEventListener('offline', ()=> console.log("offline"));
copy
Full Javascript cheatsheet