how to check if user lost internet connection

Sometimes losing time on the web I noticed some websites have specific ways to deal with a user who has lost his connections. I wonder how. Is there an event that fires when this happens?
10 Replies
Jochem
Jochem•10mo ago
MDN Web Docs
Window - Web APIs | MDN
The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window.
Pi, a future fluent jp speaker
When a user loses his internet connection, how much time it takes for this to happen?
No description
Jochem
Jochem•10mo ago
Should be as soon as the OS notices
MarkBoots
MarkBoots•10mo ago
could take a few seconds. i remember vaguely the browsers are checking the status every x-time
Pi, a future fluent jp speaker
It is a tricky one because it can returns false positivies
No description
MarkBoots
MarkBoots•10mo ago
that is navigator.online property, different rom the online/offline events
Pi, a future fluent jp speaker
The online /offline events is based on that property
MarkBoots
MarkBoots•10mo ago
🤭 I can't read
Pi, a future fluent jp speaker
As here says
MarkBoots
MarkBoots•10mo ago
yup
Want results from more Discord servers?
Add your server