Safari 5: XMLHTTPRequest synchronous calls are timing out after 10s.
Hi,
Safary 5 is throwing an error (see below) and aborting synchronous XMLHttpRequest if the request is taking more than 10 secs (roughly) to process on the server.
NETWORK_ERR: XMLHttpRequest Exception 101: Anetwork error occurred in synchronous requests
Wrote these scripts to confirm this issue:
On the Client side:
<html>
<head>
<link rel="icon" type="image/png" href="images.jpg">
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript">
function test(){
document.getElementById("txt").innerHTML="";
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","test.php",false);
xmlhttp.send();
document.getElementById("txt").innerHTML=xmlhttp.responseText;
}
</script>
</head>
<body onload="test();">
<div id="txt"></div>
</body>
</html>
On Server Side:
<?php
sleep (8);
echo "Hello world!";
?>
________________
As long as the the sleep counter, is below 10s, the process works fine on Safari 5. But for sleep >= 10s, the same error: NETWORK_ERR: XMLHttpRequest Exception 101: Anetwork error occurred in synchronous requests is displayed (in builtin js console) and no response is observed.
Also tried this test on Safari version below 5, Firefox and IE and is working fine for any amount of time the server is taking for responding.
We have an application which make heavy use of the synchronous calls, and soon the clients will start using Safari 5. We are looking for workarounds for this, but in vain so far. Any help will be appreciated.
Thanks,
Vikash.
Mac OS X (10.6.3)