By active you mean if there was any response ?
If so, the correct way is to use timeout time.
The timeout property of the XMLHttpRequest object accepts a number in milliseconds of timeout, and the property ontimeout is the (function) call when this time is reached.
xmlHttp.timeout = 10000; //10 segundos
xmlHttp.ontimeout = function() { alert('Parece que o site está fora do ar...'); }
Different status of 200 does not mean the site is down!
The entire 200 HTTP protocol family (201, 202, 203, 204) ...) have meant that the request was successful.
In addition to the redirect responses ( family 300 ) may also be perfectly valid (for example status 304 is returned when the browser cache is used and not a new request).
Even the error statuses ( 400 and 500 ) do not mean that the server is out of line. Being out of breath means not responding ; and to determine this we use the time called timeout .