简体   繁体   English

JavaScript:如何计算页面流量使用?

[英]JavaScript: how to calculate page traffic use?

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? 我知道我可以在Developer's Tools中看到它,但是可以用纯JavaScript来获取它吗?

在此输入图像描述

I know I could read content-length header for AJAX requests, but this isn't something I'm looking for. 我知道我可以读取AJAX请求的内容长度标题,但这不是我正在寻找的东西。 I need to get all traffic that my page generates. 我需要获取我的页面生成的所有流量。 Could put it into an iframe as well, it that helps. 可以把它放到iframe中,这有帮助。

Thanks. 谢谢。

in chrome there is window.performance.memory 在chrome中有window.performance.memory

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

you can use as solution but it is third party js :- 你可以使用作为解决方案,但它是第三方js: -

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM