简体   繁体   English

显示当前网页大小

[英]Display current webpage size

Is there an easy way to show the size of an aspx webpage in bytes (ie length not screen size) - to save clicking File..Properties in the browser. 有没有一种简单的方法来显示aspx网页的大小(以字节为单位)(即长度而不是屏幕大小)-以便在浏览器中保存单击File..Properties。

Possibly some javascript method, or a way of getting it from the Response object perhaps? 可能是某些javascript方法,还是从Response对象获取它的方法?

Look at firebug. 看萤火虫。 Under the NET tab it will show you the size of all the files downloaded for a page in bytes. 在“ NET”选项卡下,它将显示为一页下载的所有文件的大小(以字节为单位)。

You can use jQuery to get the number of characters in the element with the following snippet. 您可以使用jQuery通过以下代码段获取元素中的字符数。 In most encodings, one character will be one byte. 在大多数编码中,一个字符将是一个字节。

$('html').html().length

It's worth noting that this measurement won't include the doctype declaration, but if you're using the same doctype in all pages on the site, you could count the number of bytes in the doctype and add that to the length derived from the above count. 值得注意的是,此度量将不包括doctype声明,但是如果您在网站上的所有页面中使用相同的doctype,则可以计算doctype中的字节数,并将其添加到从上面得出的长度中计数。

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

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