I've written a script that runs on a domain and fetches images from various other domains (3rd party resources).
I'm trying to use window.performance.getEntriesByType('resource')
to get a general health check of things. It seems, since these resources are on other domains that the responses would need to have Timing-Allow-Origin
set in the response header to get timing data via window.performance.getEntriesByType()
.
Is this true?
Further, when I run my script, Chrome Browser does return useful information. Indeed, I could use this data if I could get at it programmatically. But the data Chrome displays and the data returned in the window.performance.getEntriesByType()
differ.
I've attached a screenshot, which shows Chromes useful timing breakdown of loading the resource. By the performance entry object's data doesn't match.
For example, see the DNS Lookup time in the timing graph on the right, and then look at the domainLookupStart and domainLookupEnd values in the performance entry object. These values don't match up with each other.
Why is there a discrepancy and how can I get at Chrome's data? How do I derive what Chrome is displaying from the performance entry object?
Thanks!