Resource timing
The clearResourceTimings() method removes all performance entries with an entryType of "resource" from the browser's performance timeline and sets the size of the performance resource data buffer to zero.
To set the size of the browser's performance resource data buffer, use the Performance.setResourceTimingBufferSize() method.
To get notified when the browser's resource timing buffer is full, listen for the resourcetimingbufferfull event.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 29 | 12 | 35 | 11 | 29 | 11 | |
| The clearResourceTimings() method removes all performance entries with an PerformanceEntry.entryType of "resource" from the browser's performance timeline and sets the size of the performance resource data buffer to zero. | 46 | 12 | 35 | 11 | 46 | 11 |
| The resourcetimingbufferfull event is fired when the browser's resource timing buffer is full. | 46 | 79 | 35 | 11 | 46 | 11 |
| The setResourceTimingBufferSize() method sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries. | 46 | 12 | 35 | 11 | 46 | 11 |
| The connectEnd read-only property returns the DOMHighResTimeStamp immediately after the browser finishes establishing the connection to the server to retrieve the resource. The timestamp value includes the time interval to establish the transport connection, as well as other time intervals such as TLS handshake and SOCKS authentication. | 43 | 12 | 35 | 11 | 43 | 11 |
| The connectStart read-only property returns the DOMHighResTimeStamp immediately before the user agent starts establishing the connection to the server to retrieve the resource. | 43 | 12 | 35 | 11 | 43 | 11 |
| The contentType read-only property of the PerformanceResourceTiming interface is a string indicating the content type of the fetched resource, formatted as a MIME type and subtype separated by a forward slash. | 148 | 148 | 129 | | 148 | |
| The deliveryType read-only property is a string indicating how the resource was delivered — for example from the cache or from a navigational prefetch. | 117 | 117 | | 26.4 | 117 | 26.4 |
| The domainLookupEnd read-only property returns the DOMHighResTimeStamp immediately after the browser finishes the domain-name lookup for the resource. | 43 | 12 | 35 | 11 | 43 | 11 |
| The domainLookupStart read-only property returns the DOMHighResTimeStamp immediately before the browser starts the domain name lookup for the resource. | 43 | 12 | 35 | 11 | 43 | 11 |
| The fetchStart read-only property represents a DOMHighResTimeStamp immediately before the browser starts to fetch the resource. | 43 | 12 | 35 | 11 | 43 | 11 |
| The firstInterimResponseStart read-only property returns a DOMHighResTimeStamp immediately after the browser receives the first byte of the interim 1xx response (for example, or ) from the server. | 115 | 115 | | 26.4 | 115 | 26.4 |
| The initiatorType read-only property is a string representing web platform feature that initiated the resource load. | 43 | 12 | 35 | 11 | 43 | 11 |
| The nextHopProtocol read-only property is a string representing the network protocol used to fetch the resource, as identified by the ALPN Protocol ID (RFC7301). | 61 | 17 | 45 | 11 | 61 | 11 |
| The redirectEnd read-only property returns a DOMHighResTimeStamp immediately after receiving the last byte of the response of the last redirect. | 43 | 12 | 35 | 11 | 43 | 11 |
| The redirectStart read-only property returns a DOMHighResTimeStamp representing the start time of the fetch which that initiates the redirect. | 43 | 12 | 35 | 11 | 43 | 11 |
| The renderBlockingStatus read-only property returns the render-blocking status of the resource. | 107 | 107 | | | 107 | |
| The requestStart read-only property returns a DOMHighResTimeStamp of the time immediately before the browser starts requesting the resource from the server, cache, or local resource. If the transport connection fails and the browser retries the request, the value returned will be the start of the retry request. | 43 | 12 | 35 | 11 | 43 | 11 |
| The responseEnd read-only property returns a DOMHighResTimeStamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. | 43 | 12 | 35 | 11 | 43 | 11 |
| The responseStart read-only property returns a DOMHighResTimeStamp immediately after the browser receives the first byte of the response from the server, cache, or local resource. | 43 | 12 | 35 | 11 | 43 | 11 |
| The responseStatus read-only property represents the HTTP response status code returned when fetching the resource. | 109 | 109 | 129 | | 109 | |
| The secureConnectionStart read-only property returns a DOMHighResTimeStamp immediately before the browser starts the handshake process to secure the current connection. If a secure connection is not used, the property returns zero. | 43 | 18 | 35 | 11 | 43 | 11 |
| The toJSON() method of the PerformanceResourceTiming interface is a Serialization; it returns a JSON representation of the PerformanceResourceTiming object. | 45 | 16 | 35 | 11 | 45 | 11 |
worker_support Available in workers | 43 | 15 | 60 | 12 | 43 | |
| The workerStart read-only property of the PerformanceResourceTiming interface returns a DOMHighResTimeStamp immediately before dispatching the FetchEvent if 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… | 46 | 16 | 58 | 11 | 46 | 11 |
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (22)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (22)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (22)
- This feature was removed in a later browser version (57)
- Available with a vendor prefix: webkit (25)
Syntax
clearResourceTimings() Use cases
-
Using Resource timing
The clearResourceTimings() method removes all performance entries with an entryType of "resource" from the browser's performance timeline and sets the size of the performance resource data buffer to zero.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.