Table of Contents

Class PerformanceResourceTiming

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

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, {{SVGElement("SVG","SVG element")}}, image, or script.

[Value("PerformanceResourceTiming")]
public class PerformanceResourceTiming : PerformanceEntry
Inheritance
PerformanceResourceTiming
Derived
Inherited Members

Remarks

Constructors

PerformanceResourceTiming()

public PerformanceResourceTiming()

Properties

ConnectEnd

The connectEnd read-only property returns the Number 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.

[Value("connectEnd")]
public Number ConnectEnd { get; }

Property Value

Number

The connectEnd property can have the following values:

Remarks

ConnectStart

The connectStart read-only property returns the Number immediately before the user agent starts establishing the connection to the server to retrieve the resource.

[Value("connectStart")]
public Number ConnectStart { get; }

Property Value

Number

The connectStart property can have the following values:

Remarks

ContentType

NOTE
Experimental
The contentType read-only property of the PerformanceResourceTiming interface is a string indicating the content type of the fetched resource, formatted as a {{glossary("MIME type")}} and subtype separated by a forward slash.
[Value("contentType")]
public string ContentType { get; }

Property Value

string

A string indicating the MIME type "essence" of the content.
This may be one of the following values:

Remarks

The content type is a minimized and "standardized" version of the MIME type that is extracted from the Content-Type HTTP header sent in the resource's fetch response.
For JavaScript, JSON, SVG, and XML, the MIME type is replaced by a representative MIME type/subtype string.
Other types supported by the browser are represented by the MIME type/subtype string in the header (other information in the header is discarded).

See also on MDN

DecodedBodySize

The decodedBodySize read-only property returns the size (in octets) received from the fetch (HTTP or cache) of the message body after removing any applied content encoding (like gzip or Brotli). If the resource is retrieved from an application cache or local resources, it returns the size of the payload after removing any applied content encoding.

[Value("decodedBodySize")]
public ulong DecodedBodySize { get; }

Property Value

ulong

The decodedBodySize property can have the following values:

Remarks

DeliveryType

NOTE
Experimental
The deliveryType read-only property is a string indicating how the resource was delivered — for example from the cache or from a navigational prefetch.
[Value("deliveryType")]
public string DeliveryType { get; }

Property Value

string

A string, which can be one of the following values:

Remarks

DomainLookupEnd

The domainLookupEnd read-only property returns the Number immediately after the browser finishes the domain-name lookup for the resource.

[Value("domainLookupEnd")]
public Number DomainLookupEnd { get; }

Property Value

Number

The domainLookupEnd property can have the following values:

Remarks

If the user agent has the domain information in cache, DomainLookupStart and domainLookupEnd represent the times when the user agent starts and ends the domain data retrieval from the cache.

-Timing-Allow-Origin

See also on MDN

DomainLookupStart

The domainLookupStart read-only property returns the Number immediately before the browser starts the domain name lookup for the resource.

[Value("domainLookupStart")]
public Number DomainLookupStart { get; }

Property Value

Number

The domainLookupStart property can have the following values:

Remarks

EncodedBodySize

The encodedBodySize read-only property represents the size (in octets) received from the fetch (HTTP or cache) of the payload body before removing any applied content encodings (like gzip or Brotli). If the resource is retrieved from an application cache or a local resource, it must
return the size of the payload body before removing any applied content encoding.

[Value("encodedBodySize")]
public ulong EncodedBodySize { get; }

Property Value

ulong

The encodedBodySize property can have the following values:

Remarks

FetchStart

The fetchStart read-only property represents a Number immediately before the browser starts to fetch the resource.

[Value("fetchStart")]
public Number FetchStart { get; }

Property Value

Number

A Number immediately before the browser starts to fetch the
resource.

Remarks

If there are HTTP redirects, the property returns the time immediately before the user agent starts to fetch the final resource in the redirection.

Unlike many other PerformanceResourceTiming properties, the fetchStart property is available for cross-origin requests without the need of the Timing-Allow-Origin HTTP response header.

See also on MDN

FinalResponseHeadersStart

NOTE
Experimental
The finalResponseHeadersStart read-only property returns a Number immediately after the browser receives the first byte of the final document response (for example, 200 OK) from the server.
[Value("finalResponseHeadersStart")]
public Number FinalResponseHeadersStart { get; }

Property Value

Number

The finalResponseHeadersStart property can have the following values:

Remarks

This differs from RequestStart (which may also be represented as FirstInterimResponseStart), as this starts from the first bytes of any response including interim responses (for example, 103 Early Hints) with the final response coming potentially much later.

When there are no interim responses, requestStart is the same as finalResponseHeadersStart and firstInterimResponseStart is 0.

There is no end property for finalResponseHeadersStart.

-Timing-Allow-Origin
-FirstInterimResponseStart

See also on MDN

FirstInterimResponseStart

NOTE
Experimental
The firstInterimResponseStart read-only property returns a Number immediately after the browser receives the first byte of the interim 1xx response (for example, 100 Continue or 103 Early Hints) from the server.
[Value("firstInterimResponseStart")]
public Number FirstInterimResponseStart { get; }

Property Value

Number

The firstInterimResponseStart property can have the following values:

NOTE
As Early Hints are typically only supported on the main navigation request, which is by definition same-origin, a 0 typically indicates Early Hints were not used.
When the firstInterimResponseStart is non-zero, that indicates it should be the same value as RequestStart for supporting browsers.

Remarks

There is no end property for firstInterimResponseStart.

-Timing-Allow-Origin
-FinalResponseHeadersStart

See also on MDN

InitiatorType

The initiatorType read-only property is a string representing web platform feature that initiated the resource load.

[Value("initiatorType")]
public string InitiatorType { get; }

Property Value

string

The initiatorType property can have the following values, or other if none of the conditions match.

Remarks

NOTE

This property does not represent the type of content fetched. A .css file can be fetched using a link element leading to an initiatorType of link. When loading images using background: url() in a CSS file, the initiatorType will be css and not img.

See also on MDN

NextHopProtocol

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).

[Value("nextHopProtocol")]
public string NextHopProtocol { get; }

Property Value

string

The nextHopProtocol property can have the following values:

Remarks

When a proxy is used, if a tunnel connection is established, this property returns the ALPN Protocol ID of the tunneled protocol. Otherwise, this property returns the ALPN Protocol ID of the first hop to the proxy.

-Timing-Allow-Origin
-HTTP 2
-HTTP 3

See also on MDN

RedirectEnd

The redirectEnd read-only property returns a Number immediately after receiving the last byte of the response of the last redirect.

[Value("redirectEnd")]
public Number RedirectEnd { get; }

Property Value

Number

The redirectEnd property can have the following values:

Remarks

When fetching a resource, if there are multiple HTTP redirects, and any of the redirects have an origin that is different from the current document, and the timing allow check algorithm passes for each redirected resource, this property returns the time immediately after receiving the last byte of the response of the last redirect; otherwise, zero is returned.

To get the amount of redirects, see also RedirectCount.

-RedirectCount
-Timing-Allow-Origin

See also on MDN

RedirectStart

The redirectStart read-only property returns a Number representing the start time of the fetch which that initiates the redirect.

[Value("redirectStart")]
public Number RedirectStart { get; }

Property Value

Number

The redirectStart property can have the following values:

Remarks

If there are HTTP redirects when fetching the resource and if any of the redirects are not from the same origin as the current document, but the timing allow check algorithm passes for each redirected resource, this property returns the starting time of the fetch that initiates the redirect; otherwise, zero is returned.

To get the amount of redirects, see also RedirectCount.

-RedirectCount
-Timing-Allow-Origin

See also on MDN

RenderBlockingStatus

The renderBlockingStatus read-only property returns the render-blocking status of the resource.

[Value("renderBlockingStatus")]
public RenderBlockingStatusType RenderBlockingStatus { get; }

Property Value

RenderBlockingStatusType

The renderBlockingStatus property can have the following values:

Remarks

It is useful to determine resources that:

See also on MDN

RequestStart

The requestStart read-only property returns a Number 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 retires the request, the value returned will be the start of the retry request.

[Value("requestStart")]
public Number RequestStart { get; }

Property Value

Number

The requestStart property can have the following values:When the FirstInterimResponseStart is non-zero, that indicates it should be the same value as requestStart for supporting browsers.When there are no interim responses, requestStart is the same as finalResponseHeadersStart and firstInterimResponseStart is 0.

Remarks

There is no end property for requestStart. To measure the request time, calculate ResponseStart - requestStart (see the example below).

-Timing-Allow-Origin

See also on MDN

ResponseEnd

The responseEnd read-only property returns a Number immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first.

[Value("responseEnd")]
public Number ResponseEnd { get; }

Property Value

Number

A Number immediately after the browser receives the last
byte of the resource or immediately before the transport connection is closed, whichever
comes first.

Remarks

Unlike many other PerformanceResourceTiming properties, the responseEnd property is available for cross-origin requests without the need of the Timing-Allow-Origin HTTP response header.

See also on MDN

ResponseStart

The responseStart read-only property returns a Number immediately after the browser receives the first byte of the response from the server, cache, or local resource.

[Value("responseStart")]
public Number ResponseStart { get; }

Property Value

Number

The responseStart property can have the following values:

Remarks

ResponseStatus

The responseStatus read-only property represents the HTTP response status code returned when fetching the resource.

[Value("responseStatus")]
public ushort ResponseStatus { get; }

Property Value

ushort

The responseStatus property can have the following values:

Remarks

SecureConnectionStart

The secureConnectionStart read-only property returns a Number immediately before the browser starts the handshake process to secure the current connection. If a secure connection is not used, the property returns zero.

[Value("secureConnectionStart")]
public Number SecureConnectionStart { get; }

Property Value

Number

The secureConnectionStart property can have the following values:

Remarks

ServerTiming

The serverTiming read-only property returns an array of PerformanceServerTiming entries containing server timing metrics.

[Value("serverTiming")]
public PerformanceServerTiming[] ServerTiming { get; }

Property Value

PerformanceServerTiming[]

An array of PerformanceServerTiming entries.

Remarks

Server timing metrics require the server to send the Server-Timing header. For example:

The serverTiming entries can live on navigation and resource entries.

-PerformanceServerTiming
-Server-Timing

See also on MDN

TransferSize

The transferSize read-only property represents the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body (as defined by RFC7230).

[Value("transferSize")]
public ulong TransferSize { get; }

Property Value

ulong

The transferSize property can have the following values:

Remarks

If the resource is fetched from a local cache, or if it is a cross-origin resource, this property returns zero.

-Timing-Allow-Origin

See also on MDN

WorkerStart

The workerStart read-only property of the PerformanceResourceTiming interface returns a
Number 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 will always return 0.

[Value("workerStart")]
public Number WorkerStart { get; }

Property Value

Number

The workerStart property can have the following values:

Remarks

Methods

ToJSON()

The toJSON() method of the PerformanceResourceTiming interface is a {{Glossary("Serialization","serializer")}}; it returns a JSON representation of the PerformanceResourceTiming object.

[Value("toJSON")]
public Object ToJSON()

Returns

Object

A {{jsxref("JSON")}} object that is the serialization of the PerformanceResourceTiming object.

Remarks