The PerformanceResourceTiming interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script.
The interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, DNS lookup start and end times, response start and end times, etc.. Additionally, the interface extends PerformanceEntry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch.
<div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceEntry</text></a><polyline points="161,25 171,20 171,30 161,25" stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming" target="_top"><rect x="201" y="1" width="250" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="326" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceResourceTiming</text></a></svg></div>
a:hover text { fill: #0095DD; pointer-events: all;}
Properties
This interface extends the following PerformanceEntry properties for resource performance entry types by qualifying and constraining them as follows:
-
PerformanceEntry.entryTypeRead only - Returns
"resource". PerformanceEntry.nameRead only- Returns the resources URL.
PerformanceEntry.startTimeRead only- Returns the
timestampfor the time a resource fetch started. This value is equivalent toPerformanceEntry.fetchStart. PerformanceEntry.durationRead only- Returns a
timestampthat is the difference between theresponseEndand thestartTimeproperties.
The interface also supports the following properties which are listed in the order in which they are recorded for the fetching of a single resource. An alphabetical listing is shown in the navigation, at left.
PerformanceResourceTiming.initiatorTypeRead only- A
stringrepresenting the type of resource that initiated the performance entry, as specified inPerformanceResourceTiming.initiatorType. PerformanceResourceTiming.nextHopProtocolRead only- A
stringrepresenting the network protocol used to fetch the resource, as identified by the ALPN Protocol ID (RFC7301). PerformanceResourceTiming.workerStartRead only- Returns a
DOMHighResTimeStampimmediately before dispatching theFetchEventif a Service Worker thread is already running, or immediately before starting the Service Worker thread if it is not already running. If the resource is not intercepted by a Service Worker the property will always return 0. PerformanceResourceTiming.redirectStartRead only- A
DOMHighResTimeStampthat represents the start time of the fetch which initiates the redirect. PerformanceResourceTiming.redirectEndRead only- A
DOMHighResTimeStampimmediately after receiving the last byte of the response of the last redirect. PerformanceResourceTiming.fetchStartRead only- A
DOMHighResTimeStampimmediately before the browser starts to fetch the resource. PerformanceResourceTiming.domainLookupStartRead only- A
DOMHighResTimeStampimmediately before the browser starts the domain name lookup for the resource. PerformanceResourceTiming.domainLookupEndRead only- A
DOMHighResTimeStamprepresenting the time immediately after the browser finishes the domain name lookup for the resource. PerformanceResourceTiming.connectStartRead only- A
DOMHighResTimeStampimmediately before the browser starts to establish the connection to the server to retrieve the resource. PerformanceResourceTiming.connectEndRead only- A
DOMHighResTimeStampimmediately after the browser finishes establishing the connection to the server to retrieve the resource. PerformanceResourceTiming.secureConnectionStartRead only- A
DOMHighResTimeStampimmediately before the browser starts the handshake process to secure the current connection. PerformanceResourceTiming.requestStartRead only- A
DOMHighResTimeStampimmediately before the browser starts requesting the resource from the server. PerformanceResourceTiming.responseStartRead only- A
DOMHighResTimeStampimmediately after the browser receives the first byte of the response from the server. PerformanceResourceTiming.responseEndRead only- A
DOMHighResTimeStampimmediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. PerformanceResourceTiming.transferSizeRead only- A
numberrepresenting the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body. PerformanceResourceTiming.encodedBodySizeRead only- A
numberrepresenting the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings. PerformanceResourceTiming.decodedBodySizeRead only- A
numberthat is the size (in octets) received from the fetch (HTTP or cache) of the message body, after removing any applied content-codings. PerformanceResourceTiming.serverTimingRead only- An array of
PerformanceServerTimingentries containing server timing metrics.
Methods
PerformanceResourceTiming.toJSON()- Returns a
DOMStringthat is the JSON representation of thePerformanceResourceTimingobject.
Example
See the example in Using the Resource Timing API.
Specifications
| Specification | Status | Comment |
|---|---|---|
| Resource Timing Level 1 The definition of 'PerformanceResourceTiming' in that specification. |
Candidate Recommendation | Initial definition. |
Browser compatibility
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome Full support 43 | Edge Full support Yes | Firefox Full support 40 | IE Full support 10 | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
connectEnd | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE Full support 10 | Opera Full support 32 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 32 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
connectStart | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE Full support 10 | Opera Full support 32 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 32 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
decodedBodySize | Chrome Full support 54 | Edge Full support 17 | Firefox No support No | IE No support No | Opera Full support 41 | Safari No support No | WebView Android Full support 54 | Chrome Android Full support 54 | Edge Mobile Full support 17 | Firefox Android No support No | Opera Android Full support 41 | Safari iOS No support No | Samsung Internet Android Full support 6.0 |
| Basic support | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
domainLookupStart | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
encodedBodySize | Chrome Full support 54 | Edge Full support 17 | Firefox No support No | IE No support No | Opera Full support 41 | Safari No support No | WebView Android Full support 54 | Chrome Android Full support 54 | Edge Mobile Full support 17 | Firefox Android No support No | Opera Android Full support 41 | Safari iOS No support No | Samsung Internet Android Full support 6.0 |
fetchStart | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
initiatorType | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
nextHopProtocol | Chrome Full support 61 | Edge Full support 17 | Firefox Full support 51 | IE No support No | Opera No support No | Safari No support No | WebView Android Full support 61 | Chrome Android Full support 61 | Edge Mobile Full support 17 | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
redirectEnd | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
redirectStart | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
requestStart | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
responseEnd | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
responseStart | Chrome Full support 43 | Edge Full support 12 | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
secureConnectionStart | Chrome Full support 43 | Edge Full support Yes | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
serverTiming | Chrome Full support 65 | Edge ? | Firefox Full support 61 | IE No support No | Opera Full support 52 | Safari ? | WebView Android Full support 65 | Chrome Android Full support 65 | Edge Mobile ? | Firefox Android Full support 61 | Opera Android Full support 52 | Safari iOS ? | Samsung Internet Android ? |
transferSize | Chrome Full support 54 | Edge Full support 17 | Firefox No support No | IE No support No | Opera Full support 41 | Safari No support No | WebView Android Full support 54 | Chrome Android Full support 54 | Edge Mobile Full support 17 | Firefox Android No support No | Opera Android Full support 41 | Safari iOS No support No | Samsung Internet Android Full support 6.0 |
workerStart | Chrome Full support 43 | Edge Full support 16 | Firefox Full support 58 | IE No support No | Opera Full support 32 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 58 | Opera Android Full support 32 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
toJSON | Chrome Full support 43 | Edge Full support Yes | Firefox Full support 40 | IE No support No | Opera Full support 30 | Safari Full support 11 | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 42 | Opera Android Full support 30 | Safari iOS Full support 11 | Samsung Internet Android Full support 4.0 |
| Available in workers | Chrome Full support 43 | Edge Full support Yes | Firefox Full support 60 | IE No support No | Opera Full support 32 | Safari No support No | WebView Android Full support 43 | Chrome Android Full support 43 | Edge Mobile Full support Yes | Firefox Android Full support 60 | Opera Android Full support 32 | Safari iOS No support No | Samsung Internet Android Full support 4.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown