it is possible to know when user has internet connection and when no. I've tried this:
window.addEventListener('online', () => {
// some stuff
}, false);
window.addEventListener('offline', () => {
// some stuff
}, false);
as well have tried window.navigator.online.
All above things works fine just when go to network tab from developer tools and disable/enable it, but it doesn't work when you go and disable WiFi or turn off the router for example.
It is possible somehow to subscribe to this network changes in js?
Many thanks!