并发下载

发布于 2024-10-01 12:18:27 字数 121 浏览 2 评论 0原文

我一直在监视 Firebug 的 Net 面板,并注意到必须先下载 HTML,然后才能下载任何其他资源。我想这是有道理的,因为其他资源是在 HTML 中定义的。有没有办法解决这个问题,以便在 HTML 下载期间可以下载其他组件?

I've been monitoring the Net panel of Firebug and noticed that the HTML has to be downloaded first before any other resources are downloaded. I guess this make sense since the other resources are defined in the HTML. Is there a way around this so that other components can be downloaded during the HTML download?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

演出会有结束 2024-10-08 12:18:27

调试 101:调试时看到的内容与不查看时看到的内容不同。

大多数浏览器在下载时启动 HTML 解释,并同时开始下载其他资源。 Firebug 不是看到这种情况发生的好地方,请尝试使用 HTTPFox。

现在,回答您的问题:您无需执行任何操作即可让浏览器在下载 HTML 时下载其他组件,它会为您处理好这些事情。

Debugging 101: what you see while debugging is different than what happens when you are not looking.

Most browsers start the HTML interpretation while downloading it, and start downloading the additional resources concurrently. Firebug is not a great place to see that happening, try HTTPFox instead.

Now, to answer your question: you don't need to do anything to make the browser download the other components while downloading your HTML, it'll take care of that for you.

跨年 2024-10-08 12:18:27

否 - 浏览器首先需要一个可解析的 HTML 文档,然后才能开始下载脚本、图像等。

不过,您可以通过将非 HTML 元素移动到不同的子域来加快非 HTML 元素的下载速度:浏览器有每个主机的连接数限制,可以通过使用子域来规避。此外,您可以压缩/缩小 CSS/JavaScript 文件以减小其大小。

No - the browser needs a parseable HTML document first before it can start downloading scripts, images, etc.

You can speed up downloading of the non-HTML elements by moving them to different subdomains though: Browsers have a connections-per-host limit which is circumvented by using subdomains. Additionally you could compress/minify your CSS/JavaScript files to reduce their size.

榆西 2024-10-08 12:18:27

人们有可能创建一个小的 HTML 文件,然后通过各种类似 AJAX 的调用发出多个请求来填充页面的其余部分,但如果有人禁用了 JavaScript,那么该页面可能看起来非常糟糕。从某种意义上说,这会取出一些原始 HTML 内容并单独下载,这可能是也可能不是一个好主意。从某种意义上说,虽然这使用了更多的网络资源,因为在这种情况下会出现许多完全加载页面的请求,但这是一个可接受的权衡的问题。

There is the potential for one to create a small HTML file that then makes several requests to fill in the rest of the page through various AJAX-like calls, but if someone has JavaScript disabled then the page may look really bad. In a sense this is taking out some of the original HTML content and having it be downloaded separately which may or may not be a good idea. In a sense though this is using more network resources as there would be many requests to fully load the page in this case but it is a question of what is an acceptable trade-off.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文