PDA

View Full Version : detect error on loading content in frame


pangfai
09-23-2002, 11:26 AM
My web page contains 2 frames : leftpane and rightpane.

The leftpane is intended to reload rightpane at a regular interval every 5 seconds. Due to low bandwidth connecting to web server, such reload might fail. I tried try() and catch(), but they seems unable to handle this kind of error.

The intended result is : if it cannot reload rightpane, reload again and again.

The extract of the code of rightpane is as follows :
try {
function refreshlist() {
parent.rightpane.location = 'www.yyy.com';
}
}
catch (dummy) {
alert('Load error');
refreshlist()
}

Alekz
09-23-2002, 11:38 AM
Hi,
You could do the following things:

1. Establish a timer on the leftpane. If after X seconds leftpane have not recieved a message from rightpane, reload rightpane explicitely
2. Catch the body.onload event on the rightpane and invoke a function from leftpane telling him content is loaded. Also reset the timer on leftpane to zero.

Alex

Mr J
09-23-2002, 07:46 PM
Something like this maybe

function refreshlist() {
parent.rightpane.location = 'www.yyy.com';
setTimeout("checkme()",5000)
}


function checkme(){
if(parent.rightpane.location != 'www.yyy.com';){
refreshlist()
}

pangfai
09-24-2002, 10:56 AM
Thanks Alekz and Mr. J

I've tried both suggestion. Alekz's suggestion works.

Mr. J 's suggestion looks more simple, but I found that the location must be www.yyy.com no matter it actually loads it successful or not.