connectivity,internet,internet connectivity,internet connection,connction, checking if internet  connectivity exist or is lost, Shopinson, Shopinson

While checking if my internet connectivity of have been lost there are so many answers regarding this on the internet  such as on stackoverflow , kirupa but on subinb sucks since they cannot be able to provide a valid crew to solution regarding this question on the internet.

Until I came by the answer right in my email Titled How to Check Internet Connection Exists or Not using Javascript? from w3lessons i have rest of mind

So i checked in and found this below with explanation

This findings is simple and comprehensive step by step

<head>
<script src="../offline.min.js"></script>

<!--
Themes:
<link rel="stylesheet" href="./themes/offline-theme-default.css" />
<link rel="stylesheet" href="./themes/offline-theme-default-indicator.css" />
<link rel="stylesheet" href="./themes/offline-theme-slide.css" />
<link rel="stylesheet" href="./themes/offline-theme-slide-indicator.css" />
<link rel="stylesheet" href="./themes/offline-theme-chrome.css" />
<link rel="stylesheet" href="./themes/offline-theme-chrome-indicator.css" />
<link rel="stylesheet" href="./themes/offline-theme-hubspot.css" />
-->

<link rel="stylesheet" href="../themes/offline-theme-chrome.css" />
<link rel="stylesheet" href="../themes/offline-language-english.css" />

<script>
var run = function(){
  var req = new XMLHttpRequest();
  req.timeout = 5000;
  req.open('GET', 'http://localhost:8888/walter/0', true);
  req.send();
}

setInterval(run, 3000);
</script>
</head>
<body>
</body>

download the javascript files for checking internet connectivity lost or recovered

after download the zip file (Offline Master) extract the content in your root site folder

1. simply add the below code right after this tag </head>

explanation: these are two stylesheet (css) responsible for styling the disconnectivity status panel

2. Then add the following  below javascript code snippet immediately before the tag </body>

explanation : this pings the image named tiny-image.gif on website host server directory

3. Finally put this path of the below javascript immediately after same tag </body>

explanation: here is the offline.js plugin that performs the whole functions.


0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

shopinson-logo-32

©2020 Shopinson: complete guide to programming language

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account