You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/api/globals.md
+25
Original file line number
Diff line number
Diff line change
@@ -629,6 +629,31 @@ logical processors available to the current Node.js instance.
629
629
console.log(`This process is running on ${navigator.hardwareConcurrency}`);
630
630
```
631
631
632
+
### `navigator.onLine`
633
+
634
+
<!-- YAML
635
+
added: REPLACEME
636
+
-->
637
+
638
+
* {boolean}
639
+
640
+
The [`navigator.onLine`](https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-online-dev) read-only property returns the online status available
641
+
of the current Node.js instance. If the Node.js instance is not able to detect
642
+
to a local area network (LAN) or a router, it is offline; all other conditions
643
+
return true. So while you can assume that the Node.js instance is offline when
644
+
it returns a false value, you cannot assume that a true value necessarily
645
+
means that the Node.js instance can access the internet. You could be getting
646
+
false positives, such as in cases where the computer is running a
647
+
virtualization software that has virtual ethernet adapters that are always
648
+
"connected."
649
+
650
+
Therefore, if you really want to determine the online status of the Node.js
651
+
instance, you should develop additional means for checking.
652
+
653
+
```js
654
+
console.log(`This process is ${navigator.onLine?'online':'offline'}`);
0 commit comments