MoreLesson 234Free preview
Offline Detection
This lesson is part of How To · All levels
Summary
Offline detection allows pages to notify users when a connection is disconnected. The browser provides navigator.onLine as well as online and offline events that JavaScript can monitor. But this status is only an estimate of the network connection, not a guarantee that the destination server is actually accessible.
Key points
- Navigator.onLine is worth true or false to estimate connection status
- Online and offline events installed on the window
- Display a banner or a status message so that the user knows the condition of the connection
- To ensure server access, you still need real request verification
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.