Navigator.onLine Returns the online status of the browser. true meaning online and false meaning offline. The property sends updates whenever the browser's ability to connect to the network changes.

turn on/off your data / wifi to check this