Resolved bug to check if window.navigator.onLine is present