Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. PerformanceServerTiming
  4. name

PerformanceServerTiming: name property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨March 2023⁩.

Note: This feature is available inWeb Workers.

Thename read-only property returns astring value of the server-specified metric name.

Value

A string.

Examples

Logging server timing entries

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

http
Server-Timing: cache;desc="Cache Read";dur=23.2

TheserverTiming entries can live onnavigation andresource entries.

Example using aPerformanceObserver, which notifies of newnavigation andresource performance entries as they are recorded in the browser's performance timeline. Use thebuffered option to access entries from before the observer creation.

js
const observer = new PerformanceObserver((list) => {  list.getEntries().forEach((entry) => {    entry.serverTiming.forEach((serverEntry) => {      console.log(        `${serverEntry.name} (${serverEntry.description}) duration: ${serverEntry.duration}`,      );      // Logs "cache (Cache Read) duration: 23.2"    });  });});["navigation", "resource"].forEach((type) =>  observer.observe({ type, buffered: true }),);

Example usingPerformance.getEntriesByType(), which only showsnavigation andresource performance entries present in the browser's performance timeline at the time you call this method:

js
for (const entryType of ["navigation", "resource"]) {  for (const { name: url, serverTiming } of performance.getEntriesByType(    entryType,  )) {    if (serverTiming) {      for (const { name, description, duration } of serverTiming) {        console.log(`${name} (${description}) duration: ${duration}`);        // Logs "cache (Cache Read) duration: 23.2"      }    }  }}

Specifications

Specification
Server Timing
# dom-performanceservertiming-name

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp