1

If a web page is loading a very large chunk of JSON, and displaying a progress bar to assure the user that something is actually happening while he's waiting, is it possible to actually measure how much of the JSON has been downloaded at any given time, so that the progress bar can actually reflect reality, rather than a wild guess?

The total size of the file would be determined by getting the Content-Length response header.

Community
  • 1
  • 1
iconoclast
  • 21,213
  • 15
  • 102
  • 138
  • take a look into this http://stackoverflow.com/questions/18836482/xhr-download-and-upload-progress – Eugene P. Feb 04 '14 at 20:41
  • 1
    Yes, if the browser being used supports it. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest – Kevin B Feb 04 '14 at 20:41

1 Answers1

1

If browser has support, you can track loading progress by means of this: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest

To know more about browser support of this feature, just take a look at: http://caniuse.com/#feat=xhr2