2

I want to write my own Firefox Addon and my Goal is for it to show the User how many bytes were received on the loaded website.

For now, I do it with a XMLHttpRequest. Then I look into the responseText.length. This length only gives me the length of one file though. For example, if the URL is http://www.test.de/index.html, I only get the size of index.html.

But I want to have the size of every file such as the CSS files, loaded images etc. Similar to what FireBug does with it on their Network Panel.

My Question is, how to get the size of all loaded bytes for a specific website per Javascript!

davidOhara
  • 1,008
  • 5
  • 17
  • 39
  • I want to get the size of all loaded bytes for a specific website per Javascript! – davidOhara Apr 10 '13 at 14:08
  • Have you made an attempt at this yourself? If so, please add any errors or problems that you encountered to your question. If not, then your question will probably be closed as not a real question due to it being incomplete and vague. – Ren Apr 10 '13 at 14:13
  • Also, see this - http://stackoverflow.com/questions/12624268/display-file-size-of-externally-loaded-resources-for-an-html-page. Perhaps the information there may be helpful. – Ren Apr 10 '13 at 14:16

1 Answers1

0

Just for jQuery ajax requests:

var count = 0;
$(document).ajaxComplete(function(event, xhr, settings) {
  count += xhr.getResponseHeader('Content-Length');
});