ie6 multiple xhr objects

hello,

I would like to have page which uses a few xhr objects
and automatically (after 30 seconds) starts the same few requests again

It works for me well in IE7, IE8, but not IE6 (where is in browsing history
chosen option “automatically” ). It works there only for first time and I can’t
set it for circular reloading. It looks like page is reloaded, but xhr objects are
not doing their job …only - as I wrote - for first time after page load.

I have tried a lot of things:

  • headers: no-caching
  • window.reload(true)
  • window.setInterval
  • window.location.assign

nothing helps

Any idea?
thanks
Adenin

PS: I posted this by mistake as reply to another thread …sorry for that

If you’re sending something like cache-control: no-cache, for the url that ajax is fetching, I really think it should work, but I don’t have ie6 to test. It could be cached right now, not seeing your new headers. Try fetching a different url.

Are you creating a new xmlhttp object for each request? I would.

Could the fact that IE6 can only run two http requests at a time be what is causing the problem. It has to wait for one of the first two to complete before the third can start so maybe it is still working its way through the first lot when you try to start them over.

I added also cache-control for url that ajax is fetching, but it did not help.
I also changed that url, to allow browser to see new headers …nothing

for handling xhr objects I used approach described here: http://drakware.com/?e=3

any other idea?

I have now headers for html page:
<META HTTP-EQUIV=“REFRESH” CONTENT=30>
<META HTTP-EQUIV=“Pragma” CONTENT=“no-cache”>
<META HTTP-EQUIV=“Expires” CONTENT=“-1”>
<META HTTP-EQUIV=“Cache-Control” CONTENT=“no-cache” >

and in onload is called function which handles xhr objects, there are also
few alerts which shows progress of xhr’s work. There is displayed each state
of this progress (1,2,3,4) each time page is reloaded, but only at first time when page is loaded are really actual data and each next time I get only cached data :frowning:

thanks in advance …

I reduced my 10 requests to only one, but it did not help, still cached data

Hm. Try changing the urls each request by appending some junk to the query string(use the Date object to get the current miliseconds). The browser can’t possibly cache a url it’s never seen. But, this shouldn’t be necessary if the proper http headers are served unless there’s something more going on with ie6.

What headers are being sent for the ajax handler script? You can use a browser plugin(eg livehttpheaders for firefox) to view them.

I added
+“?”+ (+new Date()).toString(36) + “=” + (+new Date()).toString(36)
and it works well now

thanks for tip

regarding headers:
I catch this with wireshark ( I will try if livehttpheaders shows something else)
it is from response of request generated by xhr object:
[SIZE=“1”]
Hypertext Transfer Protocol
HTTP/1.1 200 OK\r\

Date: Tue, 27 Apr 2010 06:54:05 GMT\\r\

Server: Microsoft-IIS/6.0\\r\

MicrosoftOfficeWebServer: 5.0_Pub\\r\

X-Powered-By: ASP.NET\\r\

Content-Length: 363
Content-Type: text/html\\r\

Cache-control: private\\r\

\\r\

Line-based text data: text/html
<html>\r\

&lt;head&gt;\\r\

&lt;!--HTTP 1.0--&gt;\\r\

&lt;META Http-Equiv="Cache-Control" Content="no-cache"&gt;\\r\

&lt;!--HTTP 1.1--&gt;\\r\

&lt;META Http-Equiv="Pragma" Content="no-cache"&gt;\\r\

&lt;!--prevent proxy cache--&gt;\\r\

&lt;META Http-Equiv="Expires" Content="0"&gt;\\r\

&lt;/head&gt;\\r\

&lt;body&gt;\\r\

…[/SIZE]

Well, there’s your problem. There’s no http headers which tell the browser it is not safe to cache the response. In fact, you actually hint to the browser that it should be cached in a private local cache.

meta http-equiv is not a real http header, and browsers and a lot of other software ignore them in many scenarios.

thank you, it is solved now. I did not know about this “http-equiv” issue.

pages which I call through AJAX are asp pages, so I used

Response.AddHeader "Cache-Control","no-Cache"
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "Expires","0"

and resulting headers after that look like this:

    HTTP/1.1 200 OK\\r\

    Date: Wed, 28 Apr 2010 05:52:23 GMT\\r\

    Server: Microsoft-IIS/6.0\\r\

    MicrosoftOfficeWebServer: 5.0_Pub\\r\

    X-Powered-By: ASP.NET\\r\

    Cache-Control: no-Cache\\r\

    Pragma: no-cache\\r\

    Expires: 0\\r\

    Content-Length: 355
    Content-Type: text/html\\r\

    Cache-control: private\\r\

…and string from Date in url is not needed anymore and it works also in ie6
without caching :slight_smile:

thanks again

:tup: