Returns the online status of the browser.
Returns the online status of the browser. The property returns a boolean value, with true for being online and false for being offline. The property sends updates whenever the browser's ability to connect to the network changes. The update occurs when the user follows links or when a script requests a remote page. For example, the property should return false when users click links soon after they lose internet connection.
MDN
The NavigatorOnLine interface contains methods and properties related to the connectivity status of the browser.
MDN