-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offline Detection? #35
Comments
I think this would be a great addition to the useNetworkStatus hook. I think the online/offline events API could be used. |
Hi :) I created a pull request for this feature -> #45 |
We shouldn't land support for navigator.onLine API because the API itself is unreliable. https://natalian.org/2012/07/16/navigator.onLine/ The way browsers implement navigator.onLine means that you would likely need to do something much more custom to get what you are actually after. Per MDN, in Chrome and Safari, if the browser is not able to connect to a local area network (LAN) or a router, it is offline; all other conditions return true. So while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. |
As mentioned by @anton-karlovskiy the method used for the pull request is fragile but if you still want to use offline detection using the I think we can close this issue? :) |
is there a way to detect offline state in the network, so we can serve different content, using the hooks?
The text was updated successfully, but these errors were encountered: