如何访问每个资源的性能对象在一个网页? [英] How to access performance object of every resource in a web page?

查看:110
本文介绍了如何访问每个资源的性能对象在一个网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所看到的,在 Chrome开发者工具,加载时间,花费的时间从服务器和其他信息特定的资源,所有资源的网页。

I can see, in Chrome Developer tools, loading time, time it took to get a particular resource from server and other info, for all of the resources in a webpage.

我想捕捉使用JavaScript这些统计数据。这怎么可能?

I want to capture these stats using JavaScript. How is it possible?

有可用window.performance对象,但仅用于所请求的页面,而不是为页的资源。
有什么办法来访问所有网页资源的性能对象。

there is window.performance object available, but only for the requested page, not for page resources. Is there any way to access performance object of all of the page resources.

推荐答案

还有镀铬的最新版本中的错误 - 29.0.1547.76米
当你提出一个xmlhtt prequest,可以说在下载图像,你可以看到资源200 OK网络标签与状态code下载,但performance.getEntries()或performance.getEntriesByName(resourceUrl )没有列出的资源条目。当页面加载完成并评估performance.getEntriesByName(resourceUrl)的控制台,它正确地列出。因此,有在填充的同时在性能上的条目资源项铬滞后?
在IE10,这工作完全正常。

There is still a bug in latest version of chrome - 29.0.1547.76 m When you raise an xmlhttprequest, lets say while downloading an image, you can see that the resource is downloaded with status code 200 OK in network tab, but the performance.getEntries() or performance.getEntriesByName(resourceUrl) doesn't list the resource entry. When the page load is complete and you evaluate performance.getEntriesByName(resourceUrl) in console, it lists properly. So, there is a lag in chrome while populating the resource entries in performance entries? In IE10, this works perfectly fine.

这篇关于如何访问每个资源的性能对象在一个网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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