Created
August 18, 2017 15:01
-
-
Save nakulrathore/b4c0bd8feef1e25d26f3dc2cb8200b28 to your computer and use it in GitHub Desktop.
Detect Browser Online/offline status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateOnlineStatus() | |
{ | |
console.log('online'); | |
} | |
function updateOfflineStatus() | |
{ | |
console.log('offline') | |
} | |
window.addEventListener('online', updateOnlineStatus); | |
window.addEventListener('offline', updateOfflineStatus); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment