iframe 的页面加载时间
我可能可以自己进行基准测试,但我不是 100% 确定如何去做,所以我在这里询问是否有人已经知道问题的答案。
我有一些网页,上面有大量内容,比如说,它自己的 iframe 中有一个广告。该广告包含一些 html,其中包含更多资源。广告的 html 及其所需的所有资源均从单独的域提供到父页面。
iframe 的哪些部分会延迟父页面触发的 onload 事件?另外,如果不同,需要加载 iframe 的哪些部分进行跟踪(如 Google Analytics)来确定父页面已完成加载?
I could probably go benchmark this myself but I'm not 100% sure how to go about it so I'm asking here to see if anyone knows the answer to the problem already.
I have some webpage, it has a load of content on it and say, an ad in its own iframe. The ad has some html which then includes some more resources. The html for the ad and all resources it requires are served from a separate domain to the parent page.
What parts of the iframe will delay the onload event of the parent page firing? Also, if different, what parts of the iframe need to load for tracking like Google Analytics to decide the parent page has finished loading?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
加载所有 DOM 后,不保证会触发 onload 事件。
很多时候,您会发现 onload 事件在 DOM 完全加载之前就触发了,正如许多 Javascript 开发人员所告诉您的那样。
我从中得出的结论是,您的 iframe 对 onload 事件触发的影响很小(如果有的话)。
The onload event isn't guarenteed to fire after all of the DOM has been loaded.
Quite often you'll find the onload event firing way before the DOM has fully loaded, as many a Javascript developer can tell you.
I'd summise from this that your iframe will have little, if any, effect on the onload event firing.