Updated online-offline-events.md

Added links, removed grammatical error.
This commit is contained in:
Sarthak Tripathi 2017-10-18 19:11:05 +05:30 committed by GitHub
parent 392e88db34
commit 392f4b44f0

View file

@ -1,7 +1,6 @@
# Online/Offline Event Detection
Online and offline event detection can be implemented in the renderer process
using standard HTML5 NavigatorOnLine API.
[Online and offline event](https://developer.mozilla.org/en-US/docs/Online_and_offline_events) detection can be implemented in the renderer process using [NavigatorOnLine](http://html5index.org/Offline%20-%20NavigatorOnLine.html) attribute, part of standard HTML5 API.
The navigator.onLine attribute returns `false` if the user agent will not contact the network when the user follows links or when a script requests a remote page (or knows that such an attempt would fail) i.e. definitely offline (disconnected from the network) and must return `true` otherwise.
Since all other conditions return `true`, one has to be mindful of getting false positives, as we cannot assume `true` value necessarily means that Electron can access the internet. Such as in cases where the computer is running a virtualization software that has virtual ethernet adapters that are always “connected.”
Therefore, if you really want to determine the internet access status of Electron,