XmlHttpRequest onprogress interval

前端 未结 2 2123
-上瘾入骨i
-上瘾入骨i 2020-11-30 06:45

I\'m using XmlHttpRequests to upload images to a server and I\'d like to show the user the progress of these uploads.

Unfortunately the interval between calls to my

相关标签:
2条回答
  • 2020-11-30 07:00

    The W3 sets forth the following guidelines in their XMLHttpRequest Level 2 document. Obviously varying levels of conformance across browsers are to be expected.

    Uploads:

    While the request entity body is being uploaded and the upload complete flag is false, queue a task to fire a progress event named progress at the XMLHttpRequestUpload object about every 50ms or for every byte transmitted, whichever is least frequent. - W3 XMLHttpRequest Level 2 (Bolded for emphasis)

    Downloads:

    When it is said to make progress notifications, while the download is progressing, queue a task to fire a progress event named progress about every 50ms or for every byte received, whichever is least frequent. - W3 XMLHttpRequest Level 2 (Bolded for emphasis)

    I am not aware of an api to customize this functionality.

    0 讨论(0)
  • 2020-11-30 07:05

    Also, be careful that local debugging HTTP proxies (like Charles, for instance) tend to affect progress events firing interval.

    0 讨论(0)
提交回复
热议问题