View Full Version : detecting dead servers *before* requesting a script

06-30-2004, 03:25 PM
hi all,
i have been searchin all day for a solution for this issue: i am running an ad-server (oasis) which outputs something like this:

echo('document.write("ignore me, i am just ad content no. "' . $_GET['id'] . '")');

to those who want to display my ad on their site i give this javascript which requests the above script embeddingcode.php:

<script language="javascript" src="domain/embeddingcode.php?id=10"></script>

as long as my server is accessible, everything is just fine. but people start complaining when my server is down. some browsers completely stall because domain/embeddingcode.php does not respond.
the idea is to detect if the server is responding and after that dynamically include the <script></script> section ... AND unfortunately it has to work on old browsers. i can't say "ns 4 users won't ever see my ads", that's why i can't implement a solution for DOM-scripting capable browsers only.

thanks a lot for any advice,

06-30-2004, 06:07 PM
This is completely off the wall but what about image preloading? If you put an image on the remote server and tried to preload that - would you be able to return something that you can use as a flag? But you've still got to have that <script src> tag in the page... hmmm. Not sure. Sorry :) :rolleyes:

07-06-2004, 12:44 PM
hi spudhead,
thanks anyway -- may be this is an issue that can't be covered with javascript.
best, olli