How to get current page size in KB using just javascript?(如何仅使用 javascript 获取以 KB 为单位的当前页面大小?)
问题描述
参考这个问题 , 如何获取当前页面大小 (kb), 我将使用这个大小来了解该页面的连接速度.
Referring to this question , how can i get the current page size in kb, this size i will use to know the connection speed for this page.
推荐答案
除非你的页面大小以兆字节为单位,否则结果将毫无意义.
Unless your page has size in megabytes, the result will be meaningless.
这是因为连接、发送请求和等待服务器发送回复所需的时间是 相当大 与下载页面所需的时间相比,此外 TCP/IP 还有 慢启动.
This is because time needed to connect, send request, and wait for server to send reply back is quite large compared to time required to download the page, and in addition to that TCP/IP has slow start.
您还必须考虑缓存、代理和浏览器将建立的并行连接数(例如,可能优先下载脚本和样式,使页面下载时间显得很慢).
You also have to take into account caches, proxies and number of parallel connections that browser will make (e.g. may prioritize download of scripts and styles, making page download time appear slow).
这篇关于如何仅使用 javascript 获取以 KB 为单位的当前页面大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何仅使用 javascript 获取以 KB 为单位的当前页面大小?


- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01