如何使用JavaScript获取当前页面大小的KB? [英] How to get current page size in KB using just javascript?

查看:140
本文介绍了如何使用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.

您还必须考虑浏览器将使用的缓存,代理和并行连接数(例如,可能会优先下载脚本和样式,从而使页面下载时间成为ppear慢)。

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆