Gets the time to first byte (TTFB) of a web page using the Performance API. The TTFB is the time it takes for the first byte of the response to be received by the browser.
Usage:
getTTFB().then( res => { console.log(`TTFB: ${res}`); }); Copy
getTTFB().then( res => { console.log(`TTFB: ${res}`); });
Output:
TTFB: 123 Copy
TTFB: 123
The TTFB in milliseconds, or 0 if the navigation timing information is not available.
Gets the time to first byte (TTFB) of a web page using the Performance API. The TTFB is the time it takes for the first byte of the response to be received by the browser.
Usage:
Output: