View Full Version : How to make sure remote server is up and running?

07-12-2011, 12:39 PM

I'm building a very simple app that relies on a remote server. I will use this app on many websites, so I decided to store it on one server (I have control of the remote server in question).

I need to make sure that this server is up and running, so in the case it's not I can use a fallback.

Would it be a client-side approach? A server-side approach? My guess is to use a js snippet to do the job. If I'm correct, I'll probably use jquery to perfom the task.



rnd me
07-12-2011, 08:07 PM
find any image file on the remote server, and note it's url.
you can often use icons on error pages if the content pages themselves don't have images...

if the remote server has an image, you can spy on it from any other site (almost feels like cheating huh?).

here is a working example to monitor this site:

var i=new Image;
i.onload=function(){alert("server up: "+this.src.split(/\/{1}/)[2]);};
i.onerror=function(){alert("server down: "+this.src.split(/\/{1}/)[2]);};

watch out for redesigns...