Forum Moderators: open
I have this AJAX script below that grabs content every 2 seconds from an external file. When I disconnect and reconnect to the network, Internet Explorer and Opera will continue to grab the content as before.
However, Firefox dies and I need to refresh the script to get Firefox to begin grabbing content. Is there a reason why Firefoxt is unable to reconnect to the server after the network is offline and goes online again?
My guess is Firefox does not retry at all to check if a connection is available..?
function displayOutput()
{
try
{
httpRequest.open('GET', 'test.txt', true); // Read external file
httpRequest.onreadystatechange = handleResponse;
httpRequest.send(true);
setTimeout("displayOutput()", 2000); //call displayOutput() every 2 seconds
}
catch( e1 )
{
//alert('Caught Exception: ' + e1.description);
}
}
function handleResponse()
{
try {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
alert(httpRequest.responseText);
}
else
{
//alert('There was a problem with the request.');
}
}
}
catch( e2 )
{
//alert('Caught Exception: ' + e2.description);
}
}