简体   繁体   English

HTML内容下载完成之前如何下载HTML资产

[英]How can HTML assets be download before HTML content has finished dowloading

I am trying to improve my site load speed. 我正在尝试提高网站加载速度。 When checking on the network requests, there is something that doesn't make sense to me: 检查网络请求时,对我来说没有什么意义:

How can the content that is going to be requested (css and js files) is being download before the html content has been downloaded? 在下载html内容之前,如何下载要请求的内容(css和js文件)? I have tried with a hard reload and empty cache from chrome, but this has happened again. 我尝试了从chrome进行重新加载并清空缓存,但是这种情况再次发生。 Morover, the files seem to be dowload from the server and not from the cache. 另外,文件似乎是从服务器下载的,而不是从缓存下载的。

在此处输入图片说明

Another thing I don't get, is why chrome is pating the bar chart almost all with blue, when the majority of the time is waiting for the server to respond (TTFB). 我不明白的另一件事是,为什么铬在大多数时间都在等待服务器响应(TTFB)时几乎用蓝色填充条形图。

在此处输入图片说明

Thanks in advance! 提前致谢!

There's a couple of possibilities: 有两种可能:

  1. The HTML doesn't download all at once. HTML不会一次全部下载。 It's possible for the server to send part of the page, pause, then send the rest. 服务器可能会发送部分页面,暂停然后发送其余部分。 If the part that's sent first contains references to CSS, JS, image, font, or other files, the browser can start downloading those files as soon as it sees them referenced. 如果首先发送的部分包含对CSS,JS,图像,字体或其他文件的引用,则浏览器在看到被引用的文件后便可以立即开始下载这些文件。

  2. HTTP 2.0 supports "server push", a scheme where the web server can indicate to the client through HTTP headers that it should start downloading specific other files. HTTP 2.0支持“服务器推送”,该方案是Web服务器可以通过HTTP标头向客户端指示它应该开始下载特定的其他文件的方案。 Judging from some of the file names in your network tab, you're using Cloudflare; 从“网络”标签中的某些文件名来看,您正在使用Cloudflare。 they use server push for some features, including "Rocket Loader". 他们将服务器推送功能用于某些功能,包括“火箭装载程序”。

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

相关问题 在iOS中,UIWebView如何在完成加载之前获取html DOM内容? - In iOS UIWebView how to get html DOM content before it finished loading? 避免在boomerang.js完成之前执行html内容 - Prevent execute html content before boomerang.js finished HTML/JS - 我应该如何确保用户在允许他们继续之前完成身份验证过程? - HTML/JS - How should I approach ensuring a user has finished the authentication process before allowing them to move on? 如何下载html文件时减少IE中的时间延迟? - How can we reduce the time delay in IE ,while dowloading a html file? javascript进度条加载完成后如何显示html内容 - How to display an html content after a javascript progress bar has finished loading 如何下载HTML脚本中的新内容? - How can I download new content in a HTML script? 如何下载有关页面的Facebook HTML内容 - How can I download HTML content of Facebook about pages 如何判断HTML5音频元素何时播放完毕? - How can I tell when an HTML5 audio element has finished playing? 如何在网页上的ajax完成后从url获取html - How to get html from url AFTER ajax on webpage has finished 如何使用swfobject通知HTML容器SWF已完成 - How to notify the HTML container that the SWF has finished, using swfobject
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM