let time = window.performance.timing;Navigation and resource timings / notebook
Navigation and resource timings
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const dns = time.domainLookupEnd - time.domainLookupStart;
const tcp = time.connectEnd - time.connectStart;
const tls = time.requestStart - time.secureConnectionStart;const ttfb = time.responseStart - time.navigationStart;let pageloadTime = time.loadEventStart - time.navigationStart;const dns = time.domainLookupEnd - time.domainLookupStart;const tcp = time.connectEnd - time.connectStart;const tls = time.requestStart - time.secureConnectionStart;performance.getEntriesByType("navigation").forEach((navigation) => {
console.dir(navigation);
});
performance.getEntriesByType("resource").forEach((resource) => {
console.dir(resource);
});
performance.getEntriesByType("mark").forEach((mark) => {
console.dir(mark);
});
performance.getEntriesByType("measure").forEach((measure) => {
console.dir(measure);
});
performance.getEntriesByType("paint").forEach((paint) => {
console.dir(paint);
});
performance.getEntriesByType("frame").forEach((frame) => {
console.dir(frame);
});const navigationTimings = performance.getEntriesByType("navigation");const timing = performance.getEntriesByType("navigation")[0];const protocol = timing.nextHopProtocol;const compressionSavings = 1 - timing.transferSize / timing.decodedBodySize;const compressionSavings = 1 - timing.encodedBodySize / timing.decodedBodySize;const request = timing.responseStart - timing.requestStart;const load = timing.loadEventEnd - timing.loadEventStart;const DOMContentLoaded =
timing.domContentLoadedEventEnd - timing.domContentLoadedEventStart;