XMLHttpRequest
ObjectI just love the fact that we now have /TR/XMLHttpRequest
. Anyway, The XMLHttpRequest
Object at the W3C. It still needs some work, you can help out if you like.
Why not supply XMLHttpRequest.onload
? Because IE is the only browser not supporting this? For me it's hard to see any reason for something such complicated as this two-step onreadystatechange
way.
Why not supply
XMLHttpRequest.onload
?
That was exactly what i was thinking... wouldn't that make the whole process much easier?
Just splitting up the onreadystatechange
in to:
Or am i saying something stupid here?
Another factor is that onreadystatechange
isn't available in Gecko-browsed web browsers when doing synchronous requests.
More info on the events and their quirks can be found in XMLHTTP notes: readyState and the events.
I, for one, think onload
should be a supported event as well.
Note that onload
is not really an event in most browsers. I think that in Gecko it is and we (well, I) want other browsers to make XMLHttpRequest
implement EventTarget
as well, but until that happens they are not really events, just methods invoked at the right time. Given that Internet Explorer does not support onload
, onerror
et cetera we might put that in a later version. Not sure about this version.
The problem with trying to tidy up the design is that you cannot change the browsers that have already shipped. Site developers like to suggest improvements to specs but if those suggestions make it into the spec, they won’t use them if the spec disagrees with IE and if the IE way also works with other browsers.