2

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.

Aleksandr Makov
  • 2,820
  • 3
  • 37
  • 62

1 Answers1

4

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

anshuVersatile
  • 2,030
  • 1
  • 11
  • 18
  • not exactly what I was looking for, but yeah, close https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/transferSize – Aleksandr Makov Mar 29 '16 at 11:41
  • What does Performance.memory have to do with the question of traffic use? It's about the JavaScript heap. – Stefan Reich Jul 30 '21 at 21:15