xxxxxxxxxx
<script>
window.addEventListener('offline', function() {
alert('You are now offline');
});
</script>