[英]Different file sizes of HTML file
Could somebody explain me difference in file sizes of a HTML file. 有人可以解释一下HTML文件的大小差异。 What is measured in these four cases?
这四种情况下的测量结果是什么?
Lets take as example this page http://seotoolsforexcel.com/pagesize/ 让我们以这个页面为例: http://seotoolsforexcel.com/pagesize/
ctrl+s
as HTML file without media (they are in another folder) - the HTML file size shown in Windows Explorer is 39kB . ctrl+s
将其本地保存为HTML文件而不包含媒体(它们位于另一个文件夹中)-Windows资源管理器中显示的HTML文件大小为39kB 。 Yes i know, there are indeed two sizes: file size and the place it takes on the hard drive - but i'm interesting in file size. ctrl-u
, copy the whole code and save it as txt - the file size is 17kB ctrl-u
打开源代码,请复制整个代码并将其保存为txt-文件大小为17kB Content Length
header in Chrome developer tools - the size is 4,656kB Content Length
标头-大小为4,656kB ps : i selected this file as example, because here are all four sizes different. ps :我选择此文件作为示例,因为这四个大小都不同。
pps: regarding Content length
- i added a screenshot from Chrome Developer Tools: pps:关于
Content length
-我添加了Chrome开发者工具的屏幕截图:
When you save the HTML using CTRL+S, the browser first runs the JavaScript code and adds it to the HTML. 使用CTRL + S保存HTML时,浏览器将首先运行JavaScript代码并将其添加到HTML。 In your example, there is a JavaScript code that adds a
<style>
element to the page with a bunch of CSS rules, which makes the file size bigger. 在您的示例中,有一个JavaScript代码使用一堆CSS规则在页面上添加了
<style>
元素,这使文件更大。
When you view the page source (CTRL+U), this is the exact HTML that your browser got from the server. 当您查看页面源(CTRL + U)时,这是浏览器从服务器获取的确切HTML。 The reason why in the Network tab you see only 4.9KB is because the file is downloaded compressed (gzipped), and the browser decompresses it before parsing.
在“网络”选项卡中只能看到4.9KB的原因是,下载的文件已压缩(压缩),并且浏览器在解析之前将其解压缩。
I wasn't able to see the Content-Length
response header in both Firefox and Chrome, so I don't really know why you got that number. 我在Firefox和Chrome中都看不到
Content-Length
响应标头,所以我真的不知道为什么会有这个数字。 Was the number in bytes or kilobytes? 数字是字节还是千字节?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.