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:
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 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
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
I catch this with wireshark ( I will try if livehttpheaders shows something else)
it is from response of request generated by xhr object:
Hypertext Transfer Protocol
HTTP/1.1 200 OK\r\
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.