Articles → JavaScript → Check If User Is Connected To Internet Or Not In Javascript
Check If User Is Connected To Internet Or Not In Javascript
Navigator.Online
Example
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script>
alert(navigator.onLine);
</script>
</head>
<body> </body>
</html>
Try It