JavaScript: how to calculate page traffic use?

1.3k views Asked by At

Is it possible to calculate how much traffic my page uses? I know I can see it in Developer's Tools, but would it possible to get it in plain JavaScript?

enter image description here

I know I could read content-length header for AJAX requests, but this isn't something I'm looking for. I need to get all traffic that my page generates. Could put it into an iframe as well, it that helps.

Thanks.

1

There are 1 answers

2
anshuVersatile On

in chrome there is window.performance.memory

and read https://developer.mozilla.org/en-US/docs/Web/API/Navigation_timing_API

you can use as solution but it is third party js :-

http://phantomjs.org/network-monitoring.html