listen for online/offline events on window (not body)