Using window.Navigator.onLine Web API
Check a simple example here: React offline app
The web spec we rely on is supported by IE 9+, Chrome 14+, Firefox 41+, and Safari 5+ - that's 94% of worldwide (98% of US) browser traffic.
- Use
Offline
to remind users they might need to connect to complete certain actions. - Use
Online
to let readers know the page is available offline. - Use
Online
to hide links or other content that is irrelevant when offline.