Sprawdź, czy komputer online JS

function getStatus() {
  const statusDisplay = document.getElementById("status");
  statusDisplay.textContent = navigator.onLine ? "Online" : "OFFline";
   if (statusDisplay === "Online") {
       // Do something here
   } else {
       // Do something here
   }
}
// Add your auto refresh of the status
setInterval(getStatus, 2000);
Anthony Smith