在加载事件触发后,什么样的 HTTP 请求可以挂起?

What kind of HTTP requests can be pending after the load event has fired?

我的印象是 load 事件表明页面已完成加载——这意味着页面及其依赖项的所有 HTTP 请求都已完成,但快速查看“网络”选项卡会告诉我我我错过了什么。在我正在处理的特定页面上,在此事件触发后仍有几个待处理的 HTTP 请求,其中许多与该页面相关,并且根据我的期望,应该触发(依赖于?)原始请求但显然不是't.

谁能帮我理解 load 认为对页面的依赖性以及为什么在 load 事件触发后我可能会看到这么多 HTTP activity?

如果您谈论的是 onload 事件,它会在加载对象时发生。

onload is most often used within the element to execute a script once a web page has completely loaded all content (including images, script files, CSS files, etc.).

参考:http://www.w3schools.com/jsref/event_onload.asp

load 事件不会等待您 javascript.

中请求的任何内容

它只等待您HTML请求的内容。

The load event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images, scripts, links and sub-frames have finished loading.

MDN reference

结论:如果您在脚本中请求任何内容,如图像、json 数据等。加载事件不会等待它们。