Click to See Complete Forum and Search --> : Server/Domain Status Checker


96turnerri
11-19-2003, 09:33 PM
hi i found this script to display a server status, i wish to edit it so it can be used for any domain name not just one with picture specified heres the orginal code

<script type="text/javascript">
var url = "http://www.yourprivateserver.com/foo.gif";
var img = new Image();
img.src = url;

img.onload = function()
{
// If the server is up, do this.
alert("Server is up!");
}

img.onerror = function()
{
// If the server is down, do that.
alert("Server is down!");
}
</script>

and hers my code


<script type="text/javascript">
var url = "http://www.yourdomain.com/index.htm";
var page = new Image();
page.src = url;

page.onload = function()
{
// If the server is up, do this.
alert("Server is up!");
}

page.onerror = function()
{
// If the server is down, do that.
alert("Server is down!");
}
</script>


if someone could take a look at it and see what im doing wrong that would be great, all i get is server is down, even tho i know the page exists

Thanks
96

pyro
11-19-2003, 09:37 PM
Use an image, rather than a HTML page... :)

96turnerri
11-19-2003, 09:39 PM
yeah i tried that and it works fine but the main aim is to get this to work as a domain name checker, so you enter in a domain name in a textbox press check and it returns an answer searchin for value/index.htm or php etc :rolleyes:

pyro
11-19-2003, 09:42 PM
Using a server-side language would be best.

96turnerri
11-19-2003, 09:44 PM
yeap done that just seeing if it is possible with js?

pyro
11-19-2003, 09:51 PM
Security protocols will probably get in your way of doing much....

96turnerri
11-19-2003, 09:55 PM
yes thats true ok scrap that idea thanks 4 ur help anyway

bet u say reply you bet :cool:

:p

pyro
11-19-2003, 10:01 PM
Nah, we'll switch it up:

Sure thing, dude... :p

96turnerri
11-20-2003, 04:42 AM
hehe sure thing :D