3

When using the .onprogress event handler, how often should we expect the function to be called? My own simple testing has it firing only once, but that’s on my own server.

Most examples suggest you should be able to offer some feedback to the user, but that’s only useful if the event triggers often enough.

I am interested in both downloading and uploading files.

I have checked other Stack Overflow questions, but (a) they don’t have any accepted answers, and (b) they were more concerned with whether progress was triggering at all, and put the problem down to system peculiarities.

I am interested in Pure Unadulterated Plain Vanilla JavaScript.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Manngo
  • 14,066
  • 10
  • 88
  • 110
  • 1
    I see. Roughly translated, every 50ms or byte, depending which is slowest. Thanks. – Manngo Sep 18 '16 at 04:26
  • Does the `readystatechange` (with `readyState` == 2 or 3 depending on browser) event get fired more often – Jaromanda X Sep 18 '16 at 04:28
  • 1
    @JaromandaX Much more often! A rough test over 2.5 and 5 seconds suggested that `readystatechange` triggers about every 10ms or 11ms. The same test agreed with the approx 50ms for `progress`. Incidentally, Safari seems to start with a `readystate` of 2, and then moves on to 3, which might be more comprehensive. Ditto Firefox. – Manngo Sep 19 '16 at 01:07

0 Answers0