How TO - Online Offline Detection


Learn how to detect whether the browser is online or offline with JavaScript.


Offline Detection

The onLine property of the Navigator object returns a Boolean value that specifies whether the browser is in online or offline mode:

Example

Find out whether the browser is online:

var x = "Is the browser online? " + navigator.onLine;
Try it Yourself »

Read more about the Navigator Object in our JavaScript Navigator Tutorial.


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.