我正在寻找一个网站的插件,用于检查在线服务器的状态。无论我搜索多少,我都找不到使用简单HTML或CSS的。我不能使用PHP,因为Weebly似乎不理解它。
我可以使用CSS,HTML和Javascript。我所需要的只是告诉用户服务器是在线还是离线。
正如 sami kuhmonen 所说,你可以发布一个 ajax 帖子,看看它是否失败:
编辑
该网页:
<div id="divtodiplaystatus"></div>
和 JavaScript:
$.ajax({
//your server url
url: "http://google.com",
type: "post",
data: "onlinecheck",
success: function(){
//function if server's online
document.getElementById("divtodiplaystatus").innerHTML = "Server is online!";
},
error:function(){
//function if server's offline
document.getElementById("divtodiplaystatus").innerHTML = "Server is offline :(!";
}
});