简体   繁体   English

访问网页时,网络浏览器是否有可能下载的资源列表?

[英]Is there a list of possible resources that a webbrowser will download when visiting a webpage?

I am building a spider some days now, and I am in a research on how to measure a webpage total weight in bytes. 我现在正在建造一只蜘蛛​​,并且正在研究如何以字节为单位测量网页的总重量。 Through my research I came across this problem and the simplest answer was to get the content length of the page. 通过我的研究,我遇到了这个问题,最简单的答案是获取页面的内容长度。 But there is a small problem to that, content length in bytes is not telling us anything about the images that should be downloaded to the temp folder of the browser, nor the javascript or css links from the header of the page. 但是有一个小问题,以字节为单位的内容长度不能告诉我们有关应下载到浏览器的temp文件夹中的图像的任何信息,也不能告诉我们页面标题中的javascript或css链接。 So I actually backed up my conclusions on how to actually measure a page in terms of how much bytes are needed to be sent from the server to the client for all the resources needed to a weppage to work properly and not to measure only the bytes of the document only. 因此,我实际上支持了有关如何实际测量页面的结论,即从服务器发送到客户端需要多少字节才能使weppage正常工作所需的所有资源,而不仅仅是测量其中的字节。仅文档。 So I made a list of resources that a webbrowser should download when it visits a page: 因此,我列出了Web浏览器访问页面时应下载的资源列表:

all images <img src="someimages.jpg" alt=”somedecription” >
all js files <script type="text/javascript" src="somejs.js" ></script>
all css files <link rel="stylesheet" type="text/css" href="somecss.css">
the ico file <link rel="shortcut icon" href="someico.ico">

Are there any other resources that a browser has to download when it visits the page? 浏览器访问页面时是否还需要下载其他资源? In other words, what is the list of all the possible resources that a browser does download when visiting a webpage? 换句话说,浏览器在访问网页时下载的所有可能资源的列表是什么?

There is an endless number of possibilities when it comes to media types that can be downloaded. 对于可以下载的媒体类型,存在无数种可能性。 In fact, you can "invent" your own as long as you tell your server about them. 实际上,只要您告诉服务器有关它们的信息,就可以“发明”自己的信息。

Here's a pretty good list to get you started. 这是一个不错的清单 ,可以帮助您入门。 It's not a list of tags like <video> , <object> , <img> , <audio> , but rather a list of MIME Types. 它不是<video><object><img><audio>类的tags的列表,而是MIME类型的列表。

All of these media types have a payload when downloaded and their size needs to be measured. 所有这些媒体类型在下载时都具有有效负载,因此需要测量其大小。 Also, don't forget about streaming media and long polling . 另外,不要忘记流媒体长时间轮询 Measuring those payloads can be a bit of a bear. 测量这些有效载荷可能有点麻烦。

Along with the three types you mentioned ( icon is a image file). 以及您提到的三种类型(图标是图像文件)。 one more file is downloaded when you load a page ie HttpHandler files (.axd files). 当您加载页面时,又下载了一个文件,即HttpHandler文件(.axd文件)。

any other files like pdf,zip, audio, video and other mime types, will be loaded if the page requests. 如果页面请求,则将加载其他任何文件,如pdf,zip,音频,视频和其他mime类型。

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

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