mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.11k stars 22.46k forks source link

Document false negatives for navigator.onLine property #30402

Open Sardtok opened 9 months ago

Sardtok commented 9 months ago

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine

What specific section or headline is this issue about?

Top level description

What information was incorrect, unhelpful, or incomplete?

The description claims that there can be false positives, but not false negatives. However, browser not only check for LAN connectivity on Windows. Windows has two connectivity levels, internet and LAN connectivity for each network interface. If the a connection claims there is no internet connectivity, navigator.onLine returns false. Whether there's an internet connection or not, depends on a Microsoft service, that typically breaks down when using VPN. There are workarounds by editing the Windows registry to disable the check, or use a different address for the connectivity status check.

What did you expect to see?

A mention of possible false negatives, at least on Windows. Several PWA services break down when they use navigator.onLine.

Do you have any supporting links, references, or citations?

https://answers.microsoft.com/en-us/windows/forum/all/windows-10-says-im-offline/24a9922f-e740-4b0a-94af-d7e37fef2fd3 https://answers.microsoft.com/en-us/windows/forum/all/icon-showing-no-internet-yet-there-is-internet/51f4d89c-d5e8-4b51-b781-7b8286fd33e1 https://www.reddit.com/r/PrivateInternetAccess/comments/9vz0fb/why_does_windows_think_im_offline_even_though_i/

Do you have anything more you want to share?

No response

MDN metadata

Page report details * Folder: `en-us/web/api/navigator/online` * MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/navigator/online/index.md * Last commit: https://github.com/mdn/content/commit/ef75c1741b450c2331204be5563ee964ad5f4c48 * Document last modified: 2023-04-07T06:16:45.000Z
dipikabh commented 9 months ago

Thanks @Sardtok for highlighting this gap in the docs.

To summarize for anyone fixing this issue: The page needs to be updated to reflect the possibility of false negatives, particularly on Windows systems.

@Sardtok, would you be interested in opening a Pull Request to address this?