HTML服务器状态检查器

时间:2015-04-11 18:54:49

标签: javascript html css

我正在寻找一个检查在线服务器状态的网站的插件。无论我搜索了多少,我都找不到使用简单HTML或CSS的版本。我不能使用PHP,因为Weebly似乎并不理解它。

我可以使用CSS,HTML和Javascript。 我只需要告诉用户服务器是在线还是离线。

1 个答案:

答案 0 :(得分:1)

正如sami kuhmonen所说,你可以制作一个ajax帖子并查看它是否失败:

EDITED
html:

<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 :(!";
            }
        });