Connecting Tech Pros Worldwide Forums | Help | Site Map

Trying to understand redirection script behaviour.

pdc
Guest
 
Posts: n/a
#1: Feb 14 '06
I have two web servers that I use, one is the primary and the other is a
backup for when the server is down.
I use a third, central server which redirects a browser's initial link to
one of my web servers.
Rather than getting involved with CGI to determine the status of the web
servers, I found and implemented the following javascript.

<!- this is a very simple page that uses javascript to detect
whether or not a gif file can be obtained from a system's
web server.
If the gif file cannot be found, either because the system
is down or the webserver is inactive, then the imageError
function redirects the browser to a backup server.
-->
<head>
<title>PDC's start</title>
<SCRIPT LANGUAGE = "JavaScript">
<!--
function imageError()
{
top.location = "http://webserver2/home.html";
}
function imageLoad()
{
top.location = "http://webserver1/home.html";
}
var imgTest = new Image();
imgTest.onerror = imageError;
imgTest.onload = imageLoad;
imgTest.src =
"http://webserver1/ThisGIFimageControlsWhichWebServerisChosen.gif";
-->
</SCRIPT>
<HTML>

IE. the redirection proceeds as required. Trouble is, I don't want to use
IE.

Using Firefox (1.5.0.1)
What I notice is that it is only partially successful in doing what I want.
If I rename the gif file, for example, the redirect works well and
webserver2 is chosen.
But if webserver1 or the machine that webserver1 runs on is down, then the
initial request fails, still trying to access webserver1/home.html
Is this WAD, or is there anything I can tweak to ensure that when webserver1
is unavailable then webserver2 is accessed?




pdc
Guest
 
Posts: n/a
#2: Feb 14 '06

re: Trying to understand redirection script behaviour.


just to add, my firefox browser has enabled javascript
thanks!
"pdc" <pdc@cdp.moc> wrote in message
news:lClIf.1896$_D5.183975@news20.bellglobal.com.. .[color=blue]
>I have two web servers that I use, one is the primary and the other is a
>backup for when the server is down.
> I use a third, central server which redirects a browser's initial link to
> one of my web servers.
> Rather than getting involved with CGI to determine the status of the web
> servers, I found and implemented the following javascript.
>
> <!- this is a very simple page that uses javascript to detect
> whether or not a gif file can be obtained from a system's
> web server.
> If the gif file cannot be found, either because the system
> is down or the webserver is inactive, then the imageError
> function redirects the browser to a backup server.
> -->
> <head>
> <title>PDC's start</title>
> <SCRIPT LANGUAGE = "JavaScript">
> <!--
> function imageError()
> {
> top.location = "http://webserver2/home.html";
> }
> function imageLoad()
> {
> top.location = "http://webserver1/home.html";
> }
> var imgTest = new Image();
> imgTest.onerror = imageError;
> imgTest.onload = imageLoad;
> imgTest.src =
> "http://webserver1/ThisGIFimageControlsWhichWebServerisChosen.gif";
> -->
> </SCRIPT>
> <HTML>
>
> IE. the redirection proceeds as required. Trouble is, I don't want to use
> IE.
>
> Using Firefox (1.5.0.1)
> What I notice is that it is only partially successful in doing what I
> want. If I rename the gif file, for example, the redirect works well and
> webserver2 is chosen.
> But if webserver1 or the machine that webserver1 runs on is down, then the
> initial request fails, still trying to access webserver1/home.html
> Is this WAD, or is there anything I can tweak to ensure that when
> webserver1 is unavailable then webserver2 is accessed?
>
>
>[/color]


Closed Thread