I recently found an article describing online/offline detection. It's as easy as: window.addEventListener('online', () => console.log('online'))
Works for 'offline' events too. You could also check for 'navigator.onLine'
French web developer mainly but touches everything. Volunteer mod here at DEV. I learn Nuxt at this moment and databases. — Addict to Cappuccino and Music
I recently found an article describing online/offline detection. It's as easy as:
window.addEventListener('online', () => console.log('online'))
Works for 'offline' events too. You could also check for 'navigator.onLine'
Oh nice. I believe Dev uses a version of that to disolay th3 doodle wheb youre offline ;)
Yeah from here
🚀 Detecting If a User is Online/Offline with JavaScript
Niall Maher ・ Jun 25 ・ 4 min read
Nice