How to get the timestamp of the DOM loaded?

Viewed 64

The obvious answer was using performance.timing, as described here, but it is deprecated.

The new interface seems to give only durations, but I can not see any reference of timestamp.

Example (from here):

performance.getEntriesByType('navigation').forEach((navigation) => 
{
  console.dir(navigation);
});

gives

{
    "name": "https://developer.mozilla.org/en-US/docs/Web/Performance/Navigation_and_resource_timings",
    "entryType": "navigation",
    "startTime": 0,
    "duration": 381.90000009536743,
    "initiatorType": "navigation",
    "nextHopProtocol": "h2",
    "workerStart": 0,
    "redirectStart": 0,
    "redirectEnd": 0,
    "fetchStart": 9,
    "domainLookupStart": 9,
    "domainLookupEnd": 9,
    "connectStart": 9,
    "connectEnd": 9,
    "secureConnectionStart": 9,
    "requestStart": 15.400000095367432,
    "responseStart": 49.40000009536743,
    "responseEnd": 52,
    "transferSize": 16819,
    "encodedBodySize": 16519,
    "decodedBodySize": 104257,
    "serverTiming": [],
    "workerTiming": [],
    "unloadEventStart": 0,
    "unloadEventEnd": 0,
    "domInteractive": 271.90000009536743,
    "domContentLoadedEventStart": 324.2000000476837,
    "domContentLoadedEventEnd": 324.2000000476837,
    "domComplete": 381.7000000476837,
    "loadEventStart": 381.90000009536743,
    "loadEventEnd": 381.90000009536743,
    "type": "navigate",
    "redirectCount": 0
}

Besides the documentation or implementation is way more complex. How do we get now the timestamp of the page loaded (or of startTime) ?

1 Answers

I found the answer, not by google (which gives all answers based on performance.timing), but looking all the values of performance object.

I found this:

Performance.timeOrigin

Described here

Related