PerformanceResourceTiming.encodedBodySize

The encodedBodySize property represents the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings.

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

This property is Read only .

Syntax

JavaScript
resource.encodedBodySize;

Return value

A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings.

Example

The following example, the value of the size properties of all "resource" type events are logged.

JavaScript
function log_sizes(perfEntry){
  // Check for support of the PerformanceEntry.*size properties and print their values
  // if supported.
  if ("decodedBodySize" in perfEntry)
    console.log("decodedBodySize = " + perfEntry.decodedBodySize);
  else
    console.log("decodedBodySize = NOT supported");

  if ("encodedBodySize" in perfEntry)
    console.log("encodedBodySize = " + perfEntry.encodedBodySize);
  else
    console.log("encodedBodySize = NOT supported");

  if ("transferSize" in perfEntry)
    console.log("transferSize = " + perfEntry.transferSize);
  else
    console.log("transferSize = NOT supported");
}
function check_PerformanceEntries() {
  // Use getEntriesByType() to just get the "resource" events
  var p = performance.getEntriesByType("resource");
  for (var i=0; i < p.length; i++) {
    log_sizes(p[i]);
  }
}

Specifications

Specification Status Comment
Resource Timing
The definition of 'encodedBodySize' in that specification.
Editor's Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support. No support No support No support No support No support
Feature Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support. No support No support No support No support No support No support

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/performanceresourcetiming/encodedbodysize

API Property Reference Web Performance