Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a polyfill for window.performance.getEntriesByType in Safari?

Looks like window.performance.getEntries and window.performance.getEntriesByType are not defined in Safari.

Is there a polyfill for those functions? Or did someone created sort of alternative?

What I want to do is to get all resources loaded in the page. (all images, css and js files)

like image 424
Broda Noel Avatar asked Feb 16 '17 14:02

Broda Noel


2 Answers

Due to Safari does not provide that information in any JavaScript way, it's impossible to create a Polyfill for that. Stop looking for it. You are not going to have luck with it :(

PS.: Be careful with this answer. Some functions on window.performance can be implemented with polyfills, but not the 2 that I asked for (which are necessary for some performance checks)

like image 124
Broda Noel Avatar answered Sep 28 '22 17:09

Broda Noel


Safari does implement performance.timing; The metrics are in epoch time

> performance.timing
< PerformanceTiming = $2
connectEnd: 1588977207613
connectStart: 1588977207613
domComplete: 1588977208988
domContentLoadedEventEnd: 1588977208410
domContentLoadedEventStart: 1588977208390
domInteractive: 1588977208390
domLoading: 1588977207819
domainLookupEnd: 1588977207613
domainLookupStart: 1588977207613
fetchStart: 1588977207613
loadEventEnd: 1588977209012
loadEventStart: 1588977209012
navigationStart: 1588977207613
redirectEnd: 0
redirectStart: 0
requestStart: 1588977207685
responseEnd: 1588977207826
responseStart: 1588977207804
secureConnectionStart: 0
unloadEventEnd: 0
unloadEventStart: 0
PerformanceTiming Prototype
like image 31
RayJ_inSJ Avatar answered Sep 28 '22 17:09

RayJ_inSJ