📅  最后修改于: 2022-03-11 15:01:39.206000             🧑  作者: Mango
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);