PerformanceResourceTiming.encodedBodySize - Web APIs 编辑
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-codings.
Note:
This feature is available in Web Workers.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.
Syntax
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.
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 Level 2 The definition of 'encodedBodySize' in that specification. | Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论