Re: XMLHttpRequest progress events

"Jonas Sicking" <jonas@sicking.cc>
> The problem lies in if the XHR implementation doesn't know the total size. 
> Then it can't give you a percentage.

Something needs to be defined to be done in this situation, not knowing the 
size is likely the standard in many uses of XHR.

> If it gives you the number of bytes transferred do far, the user or the 
> script can figure out the progress even if the XHR implementation doesn't 
> know the total size.

Exactly, if we look at existing implementations, the IE onProgress event 
(not available in a default security environment) provides currentBytes and 
totalBytes (or 0) which I've used for preloading resources.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/07b3e629-a558-4a0e-8307-ca922f56e00c.asp

Macromedia Flash does the same

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002219.html

If there was always a content-length, then there'd be no problem with just 
having a percentage, however there's not. It's another problem with trying 
to re-use properties from a defunct specification that considered such a 
tight range of use cases as the DOM3 L&S - it was about parsing XML 
documents, not downloading web content.

Jim.

Received on Tuesday, 25 April 2006 10:06:05 UTC