Connecting Tech Pros Worldwide Help | Site Map

checking if server is online

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 19th, 2006, 02:05 PM
hockese@gmail.com
Guest
 
Posts: n/a
Default checking if server is online

Hello members!
I have 2 servers, on the first I have these code
<script type="text/javascript" src="http://server2/test.js"></script>
But if server2 is offline, it will take 30 seconds before timeout, I
found a script who can show images if server2 is online or off, is it
possible to change it so if server2 if offline nothing happens, and if
its online the http://server2/test.js is loaded?

Im so bad at javascript

Thanx in advance!




<html>
<head></head>
<body>
<img src="http://server2/Active.gif" name="mkraft">
<script language="JavaScript1.2">
var offlineImage = new Image();
offlineImage.src = "http://server1/inActive.gif";
var bufferImage = new Image();
bufferImage.onload = showEvent;
bufferImage.onerror = errorEvent;

function requestImage() {
bufferImage.src = "http://server2/Active.gif";
}

function showEvent() {
document.images['mkraft'].src = bufferImage.src;
setTimeout("requestImage()", 0);
}

function errorEvent() {
document.images['mkraft'].src = offlineImage.src;
setTimeout("requestImage()", 0);
}

requestImage();
</script>
</body>
</html>


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.