Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Trying to understand redirection script behaviour.

Reply
Thread Tools

Trying to understand redirection script behaviour.

 
 
pdc
Guest
Posts: n/a
 
      02-14-2006
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?



 
Reply With Quote
 
 
 
 
pdc
Guest
Posts: n/a
 
      02-14-2006
just to add, my firefox browser has enabled javascript
thanks!
"pdc" <(E-Mail Removed)> wrote in message
news:lClIf.1896$(E-Mail Removed).. .
>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?
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read all of this to understand how it works. then check around on otherRead all of this to understand how it works. then check around on other thelisa martin Computer Support 2 08-18-2005 06:40 AM
Trying to Understand Layer 2 scadav Cisco 6 07-07-2005 05:24 PM
trying to understand postback jim ASP .Net 1 11-22-2004 06:45 PM
Trying to understand ticket/cookie expiration =?Utf-8?B?QmlsbCBCb3Jn?= ASP .Net 0 10-08-2004 10:43 PM
Trying to understand... Paul K ASP .Net 2 11-19-2003 11:39 AM



Advertisments