-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnectivity.js
30 lines (26 loc) · 973 Bytes
/
connectivity.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
window.addEventListener("load", (event) => {
navigator.onLine ? "Online" : "OFFline";
});
window.addEventListener("offline", (event) => {
const statusDisplay = document.getElementById("backg");
statusDisplay.innerHTML = " ";
// statusDisplay.style.fontSize = "20px";
// statusDisplay.style.textAlign = "center";
// statusDisplay.style.fontFamily = "sans-serif";
// statusDisplay.style.fontWeight = "bold";
const image = document.createElement("img");
image.src = "/favicon/internet_error.png";
image.style.width = "100%" ;
statusDisplay.append(image);
});
window.addEventListener("online", (event) => {
const statusDisplay = document.getElementById("backg");
statusDisplay.innerHTML = " ";
const image = document.createElement("img");
image.src = "/favicon/internet_ok.png";
image.style.width = "100%" ;
statusDisplay.append(image);
setInterval(function() {
window.location.reload();
},5000 );
});