Search code examples
javascriptperformanceconnectionfilesize

Is there a way to get the total size of files transferred to a page in real time using Javascript?


I am looking for a way to know how many KB of information have been transferred as a web page loads. It would be nice for example to say:

loadedSoFar = window.document.loadedKB;

Two prospective uses would be to test connection speed or to draw a progress bar.

The Mac has the Activity Monitor application that can give network usage.

Essentially what I am looking for is network usage information in realtime via Javascript.

Is there any such tool or function?

Ideally it would work without my having to calculate the file sizes of all the page components.


Solution

  • No, there is not.

    JavaScript doesn't have access to network traffic like that.