为什么不同的网络请求之间会有时间跨度? [英] Why is there a time span between different network requests?

查看:118
本文介绍了为什么不同的网络请求之间会有时间跨度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在优化Web应用程序中的加载时间,但不知道出了什么问题. Firebug的 Net 面板显示了请求之间的时间间隔.

I'm optimizing the loading times in a web app and I don't know what's the problem. Firebug's Net panel is showing time holes between requests.

有人可以向我解释一下这张图吗?

Can someone explain me this chart?

推荐答案

请求之间的差距可能有两个原因:

The gap between the requests can have two reasons:

  1. 解析请求页面所需的时间

  1. Time needed to parse the requested page

当您请求URL时,浏览器需要解析返回的内容,以检查它们是否包含指向其他资源(如JavaScript,CSS文件,图像等)的URL.也需要解析随后请求的资源.所以CSS文件可以包含对图像的引用.尽管首先需要解析CSS文件的内容才能获取这些URL.

When you request a URL, the browser needs to parse the returned contents to check whether they contain URLs to other ressources like JavaScripts, CSS files, images, etc. Subsequently requested ressources need to be parsed, too. So e.g. CSS files can contain references to images. Though the contents of the CSS file first need to be parsed to get those URLs.

动态请求的资源

可以异步请求使用JavaScript资源.可以例如触发这些请求.通过AJAX或通过将<img src="xyz.png" alt="">之类的DOM节点动态插入页面中.

Using JavaScript resources can be requested asynchronously. These requests can be triggered e.g. through AJAX or by dynamically inserting DOM nodes like <img src="xyz.png" alt=""> into the page.

这篇关于为什么不同的网络请求之间会有时间跨度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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