navigator.onLine

A browser property that is true when the browser believes it has a network connection, paired with online and offline events on window.

In more detail

A true value only means some network is available, not that your server is reachable. The events fire when the connection state changes.

Example

The course reads it with useSyncExternalStore: subscribe to the two events, read navigator.onLine as the snapshot and assume online on the server.

Related terms

Taught in

References