Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if computer 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);
 
PREVIOUS NEXT
Tagged: #check #computer #online #js
ADD COMMENT
Topic
Name
6+6 =