📌  相关文章
📜  检查计算机是否在线 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:39.206000             🧑  作者: Mango

代码示例1
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);