// example code
let Connected = window.navigator.onLine;
if (Connected) {
alert('Connection available');
} else {
alert('Connection not available');
}
function getStatus() {
const statusDisplay = document.getElementById("status");
statusDisplay.textContent = navigator.onLine ? "Online" : "OFFline";
if (statusDisplay.textContent === "Online") {
console.log('Online');
} else if (statusDisplay.textContent === "OFFline"){
console.log('Offline');
}
}
setInterval(getStatus, 2000);