2023-11-02 11:21:10 +00:00
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
checkServerStatus("https://example-1.com", "Server-1");
|
|
|
|
checkServerStatus("https://example-2.com", "Server-2");
|
|
|
|
checkServerStatus("https://example-3.com", "Server-3");
|
|
|
|
checkServerStatus("https://example-4.com", "Server-4");
|
|
|
|
});
|
|
|
|
|
|
|
|
function checkServerStatus(url, statusElementId) {
|
|
|
|
fetch(url)
|
|
|
|
.then(response => {
|
|
|
|
var statusElement = document.getElementById(statusElementId);
|
|
|
|
if (response.status === 200) {
|
|
|
|
statusElement.textContent = 'Online';
|
|
|
|
statusElement.style.color = '#00FF00'; // Grün für online
|
|
|
|
} else {
|
|
|
|
statusElement.textContent = 'Offline';
|
|
|
|
statusElement.style.color = '#FF0000'; // Rot für offline
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
var statusElement = document.getElementById(statusElementId);
|
|
|
|
statusElement.textContent = 'Offline';
|
|
|
|
statusElement.style.color = '#FF0000'; // Rot für offline
|
|
|
|
});
|
|
|
|
}
|
2023-11-01 15:14:11 +00:00
|
|
|
|