I have a little script that seems to hang up in internet explorer every now and again.
Basically, I have a php page that sets the following headers:
Expand|Select|Wrap|Line Numbers
- header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
- header( "Cache-Control: post-check=1,pre-check=2" );
- header( "Cache-Control: no-cache, must-revalidate" );
- header( "Pragma: no-cache" );
- function setExpires($expires) {
- header( 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
- }
- setExpires(5);
That function starts one xmlhttprequest (which should take about 20 seconds or so to do), and also starts a second xmlhttprequest which continuously updates users with the status of the first request....
It looks something like this:
Expand|Select|Wrap|Line Numbers
- function startSearch(usersess)
- {
- var url="/runsearch.php";
- url=url+"?usersess="+usersess;
- url=url+"&sid="+Math.random();
- searchRequest=GetXmlHttpObject();
- searchRequest.onreadystatechange=function(){
- searchReqChanged();
- }
- searchRequest.open("GET",url,true);
- searchRequest.send(null);
- getSorter(usersess);
- }
- function searchReqChanged(){
- if (searchRequest.readyState==4)
- {
- repeatSort = 0;
- }
- }
- function getSorter(usersess)
- {
- var usess= escape(encodeURI(usersess));
- var url="update.php";
- url=url+"?sid="+Math.random();
- url=url+"&usess="+usess;
- sorterRequest=GetXmlHttpObject();
- sorterRequest.onreadystatechange=function(){
- sorterReqChanged(usess);
- }
- sorterRequest.open("GET",url,true);
- sorterRequest.send(null);
- }
- function sorterReqChanged(usess){
- if (sorterRequest.readyState==4)
- {
- document.getElementById("results").innerHTML=sorterRequest.responseText;
- if (repeatSort != -1){getSorter(usess);}
- if (repeatSort == 0){repeatSort = -1;}
- }
- }
I think it has to do with the AJAX because I've tried changing startSearc() to something like a simple alert and there are no troubles..
Any help would be much appreciated, as I've been stuck on this for quite awhile now...
Many thanks.