PerformanceTiming

  • Revision slug: Web/API/PerformanceTiming
  • Revision title: PerformanceTiming
  • Revision id: 469049
  • Created:
  • Creator: teoli
  • Is current revision? Yes
  • Comment

Revision Content

{{APIRef}}

Summary

The PerformanceTiming interface represents timing-related performance information for the given page.

An object of this type can be obtained by calling the {{domxref("Performance.timing")}} read-only attribute.

Properties

The PerformanceTiming interface doesn't inherit any property.

{{domxref("PerformanceTiming.navigationStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, right after the prompt for unload terminates on the previous document in the same browsing context. If there is no previous document, this value will be the same as PerformanceTiming.fetchStart.
{{domxref("PerformanceTiming.unloadEventStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, the {{event("unload")}} event has been thrown. If there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is 0.
{{domxref("PerformanceTiming.unloadEventEnd")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, the {{event("unload")}} event handler finishes. If there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is 0.
{{domxref("PerformanceTiming.redirectStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, the first HTTP redirect starts. If there is no redirect, or if one of the redirect is not of the same origin, the value returned is 0.
{{domxref("PerformanceTiming.redirectEnd")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, the last HTTP redirect is completed, that is when the last byte of the HTTP response has been received. If there is no redirect, or if one of the redirect is not of the same origin, the value returned is 0.
{{domxref("PerformanceTiming.fetchStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, the browser is ready to fetch the document using an HTTP request. This moment is before the check to any application cache.
{{domxref("PerformanceTiming.domainLookupStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, where the domain lookup starts. If a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as PerformanceTiming.fetchStart.
{{domxref("PerformanceTiming.domainLookupEnd")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, where the domain lookup is finished. If a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as PerformanceTiming.fetchStart.
{{domxref("PerformanceTiming.connectStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, where the request to open a connection is sent to the network. If the transport layer reports an error and the connection establishment is started again, the last connection establisment start time is given. If a persistent connection is used, the value will be the same as PerformanceTiming.fetchStart.
{{domxref("PerformanceTiming.connectEnd")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, where the connection is opened network. If the transport layer reports an error and the connection establishment is started again, the last connection establisment end time is given. If a persistent connection is used, the value will be the same as PerformanceTiming.fetchStart. A connection is considered as opened when all secure connection handshake, or SOCKS authentication, is terminated.
{{domxref("PerformanceTiming.secureConnectionStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, where the secure connection handshake starts. If no such connection is requested, it returns 0.
{{domxref("PerformanceTiming.requestStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the browser sent the request to obtain the actual document, from the server or from a cache. If the transport layer fails after the start of the request and the connection is reopened, this property will be set to the time corresponding to the new request.
{{domxref("PerformanceTiming.responseStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the browser received the first byte of the response, from the server from a cache, of from a local resource.
{{domxref("PerformanceTiming.responseEnd")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server from a cache, of from a local resource.
{{domxref("PerformanceTiming.domLoading")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the parser started its work, that is when its {{domxref("Document.readyState")}} changes to 'loading' and the corresponding {{event("readystatechange")}} event is thrown.
{{domxref("PerformanceTiming.domInteractive")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the parser finished its work on the main document, that is when its {{domxref("Document.readyState")}} changes to 'interactive' and the corresponding {{event("readystatechange")}} event is thrown.
{{domxref("PerformanceTiming.domContentLoadedEventStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, right before the parser sent the {{event("DOMContentLoaded")}} event, that is right after all the scripts that need to be executed right after parsing has been executed.
{{domxref("PerformanceTiming.domContentLoadedEventEnd")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, right after all the scripts that need to be executed as soon as possible, in order or not, has been executed.
{{domxref("PerformanceTiming.domComplete")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the parser finished its work on the main document, that is when its {{domxref("Document.readyState")}} changes to 'complete' and the corresponding {{event("readystatechange")}} event is thrown.
{{domxref("PerformanceTiming.loadEventStart")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the {{event("load")}} event was sent for the current document. If this event has not yet been sent, it returns 0.
{{domxref("PerformanceTiming.loadEventEnd")}} {{readonlyInline}}
Is an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the {{event("load")}} event handler terminated, that is when the load event is completed. If this event has not yet been sent, or is not yet completed, it returns 0.

Methods

The PerformanceTiming interface doesn't implement any inherited method.

{{domxref("PerformanceTiming.toJSON()")}} {{non-Standard_Inline}}
Is a jsonizer returning a JSON object representing the specific PerformanceTiming object.

Specifications

Specification Status Comment
{{SpecName('Navigation Timing', '#sec-navigation-timing-interface', 'PerformanceTiming')}} {{Spec2('Navigation Timing')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 6.0 {{CompatGeckoDesktop("7.0")}} 9.0 15.0 {{CompatNo}}
toJSON() {{CompatNo}} {{CompatGeckoDesktop("25.0")}} 9.0 {{CompatNo}} {{CompatNo}}
Feature Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support {{CompatNo}} {{CompatGeckoMobile("7.0")}} {{CompatGeckoFxOS("7.0")}} 9.0 15.0 {{CompatNo}}
toJSON() CompatNo {{CompatGeckoMobile("25.0")}} {{CompatGeckoMobile("25.0")}}   {{CompatNo}} {{CompatNo}}

See also

  • The {{domxref("Performance.timing")}} property that creates such an object.

Revision Source

<p>{{APIRef}}</p>
<h2>Summary</h2>
<p>The <strong><code>PerformanceTiming</code></strong> interface represents timing-related performance information for the given page.</p>
<p>An object of this type can be obtained by calling the {{domxref("Performance.timing")}} read-only attribute.</p>
<h2 id="Properties">Properties</h2>
<p><em>The <code>PerformanceTiming</code> interface doesn't inherit any property.</em></p>
<dl>
  <dt>
    {{domxref("PerformanceTiming.navigationStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, right after the prompt for unload terminates on the previous document in the same browsing context. If there is no previous document, this value will be the same as <code>PerformanceTiming.fetchStart</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.unloadEventStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, the {{event("unload")}} event has been thrown. If there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is <code>0</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.unloadEventEnd")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, the {{event("unload")}} event handler finishes. If there is no previous document, or if the previous document, or one of the needed redirects, is not of the same origin, the value returned is <code>0</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.redirectStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, the first HTTP redirect starts. If there is no redirect, or if one of the redirect is not of the same origin, the value returned is <code>0</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.redirectEnd")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, the last HTTP redirect is completed, that is when the last byte of the HTTP response has been received. If there is no redirect, or if one of the redirect is not of the same origin, the value returned is <code>0</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.fetchStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, the browser is ready to fetch the document using an HTTP request. This moment is <em>before</em> the check to any application cache.</dd>
  <dt>
    {{domxref("PerformanceTiming.domainLookupStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, where the domain lookup starts. If a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as <code>PerformanceTiming.fetchStart</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.domainLookupEnd")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, where the domain lookup is finished. If a persistent connection is used, or the information is stored in a cache or a local resource, the value will be the same as <code>PerformanceTiming.fetchStart</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.connectStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, where the request to open a connection is sent to the network. If the transport layer reports an error and the connection establishment is started again, the last connection establisment start time is given. If a persistent connection is used, the value will be the same as <code>PerformanceTiming.fetchStart</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.connectEnd")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, where the connection is opened network. If the transport layer reports an error and the connection establishment is started again, the last connection establisment end time is given. If a persistent connection is used, the value will be the same as <code>PerformanceTiming.fetchStart</code>. A connection is considered as opened when all secure connection handshake, or SOCKS authentication, is terminated.</dd>
  <dt>
    {{domxref("PerformanceTiming.secureConnectionStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, where the secure connection handshake starts. If no such connection is requested, it returns <code>0</code>.</dd>
  <dt>
    {{domxref("PerformanceTiming.requestStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the browser sent the request to obtain the actual document, from the server or from a cache. If the transport layer fails after the start of the request and the connection is reopened, this property will be set to the time corresponding to the new request.</dd>
  <dt>
    {{domxref("PerformanceTiming.responseStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the browser received the first byte of the response, from the server from a cache, of from a local resource.</dd>
  <dt>
    {{domxref("PerformanceTiming.responseEnd")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server from a cache, of from a local resource.</dd>
  <dt>
    {{domxref("PerformanceTiming.domLoading")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the parser started its work, that is when its {{domxref("Document.readyState")}} changes to <code>'loading'</code> and the corresponding {{event("readystatechange")}} event is thrown.</dd>
  <dt>
    {{domxref("PerformanceTiming.domInteractive")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the parser finished its work on the main document, that is when its {{domxref("Document.readyState")}} changes to <code>'interactive'</code> and the corresponding {{event("readystatechange")}} event is thrown.</dd>
  <dt>
    {{domxref("PerformanceTiming.domContentLoadedEventStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, right before the parser sent the {{event("DOMContentLoaded")}} event, that is right after all the scripts that need to be executed right after parsing has been executed.</dd>
  <dt>
    {{domxref("PerformanceTiming.domContentLoadedEventEnd")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, right after all the scripts that need to be executed as soon as possible, in order or not, has been executed.</dd>
  <dt>
    {{domxref("PerformanceTiming.domComplete")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the parser finished its work on the main document, that is when its {{domxref("Document.readyState")}} changes to <code>'complete'</code> and the corresponding {{event("readystatechange")}} event is thrown.</dd>
  <dt>
    {{domxref("PerformanceTiming.loadEventStart")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the {{event("load")}} event was sent for the current document. If this event has not yet been sent, it returns <code>0.</code></dd>
  <dt>
    {{domxref("PerformanceTiming.loadEventEnd")}} {{readonlyInline}}</dt>
  <dd>
    Is an <code>unsigned long long</code> representing the moment, in miliseconds since the UNIX epoch, when the {{event("load")}} event handler terminated, that is when the load event is completed. If this event has not yet been sent, or is not yet completed, it returns <code>0.</code></dd>
</dl>
<h2 id="Methods">Methods</h2>
<p><em>The <code>PerformanceTiming</code></em> interface doesn't<em> implement any inherited method.</em></p>
<dl>
  <dt>
    {{domxref("PerformanceTiming.toJSON()")}} {{non-Standard_Inline}}</dt>
  <dd>
    Is a <em>jsonizer</em> returning a <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON" title="/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON">JSON object</a> representing the specific <code>PerformanceTiming</code> object.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
    <tr>
      <td>{{SpecName('Navigation Timing', '#sec-navigation-timing-interface', 'PerformanceTiming')}}</td>
      <td>{{Spec2('Navigation Timing')}}</td>
      <td>Initial definition.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>6.0</td>
        <td>{{CompatGeckoDesktop("7.0")}}</td>
        <td>9.0</td>
        <td>15.0</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>toJSON()</code></td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoDesktop("25.0")}}</td>
        <td>9.0</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th><strong>Firefox OS</strong></th>
        <th>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoMobile("7.0")}}</td>
        <td>{{CompatGeckoFxOS("7.0")}}</td>
        <td>9.0</td>
        <td>15.0</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>toJSON()</code></td>
        <td>CompatNo</td>
        <td>{{CompatGeckoMobile("25.0")}}</td>
        <td>{{CompatGeckoMobile("25.0")}}</td>
        <td>&nbsp;</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>The {{domxref("Performance.timing")}} property that creates such an object.</li>
</ul>
Revert to this revision