HAR 1.2, edited by Jan Odvarko, was taken up as a W3C Web
Performance Working Group draft (August 2012). The W3C never published it as a standard
and the draft now says “DO NOT USE … abandoned”; it remains the published text of
HAR 1.2, and this page follows it as served at
w3c.github.io/web-performance/specs/HAR/Overview.html. This page covers the file as a whole and its top-level objects; requests and
responses are on the entries page.
General rules
- A HAR file is a JSON document (RFC 4627). It must be UTF-8; no other encoding is allowed. Writers may put a byte order mark at the start and readers must ignore one.
- The document is an object with a single member,
log. - Times of day are ISO 8601 strings with a time zone, such as
2009-07-24T19:20:30.45+01:00. Durations are numbers of milliseconds. Where a duration or size does not apply or is not known, the draft uses −1. - Every object in the format may have an optional
commentstring (new in 1.2 for most objects).
Versions and custom fields
log.version is major.minor. A change that older readers can
still handle raises the minor number; a change that breaks them raises the major
number. The fields added in 1.2 over 1.1 are all optional: the comments on pages,
page timings, entries, requests, responses, cookies, post data, parameters, content,
cache and timings, and serverIPAddress, connection,
cookies[].secure, content.encoding and
timings.ssl.
A program may add its own fields; their names must start with an underscore, and no standard field ever does. Readers ignore custom fields they did not write, and ignore unknown standard fields in a file whose minor version is newer than they know.
log
| Field | Type | Required | Meaning |
|---|---|---|---|
version | string | yes | Version number of the format, such as 1.2. |
creator | object | yes | The program that wrote the file; see creator and browser. |
browser | object | no | The browser the traffic came from. |
pages | array | no | The pages loaded, in page objects. Left out when the program does not group requests by page. |
entries | array | yes | One entry per HTTP request. Writers should sort them by startedDateTime, oldest first; readers should not rely on the order. |
comment | string | no | A comment from the user or the program. |
creator and browser
Both objects have the same fields.
| Field | Type | Required | Meaning |
|---|---|---|---|
name | string | yes | The program’s or browser’s name. |
version | string | yes | Its version. |
comment | string | no | A comment. |
pages
Each item of log.pages:
| Field | Type | Required | Meaning |
|---|---|---|---|
startedDateTime | string | yes | When the page started loading, ISO 8601. |
id | string | yes | A name for the page, unique in the file. Entries refer to it in pageref. |
title | string | yes | The page’s title. |
pageTimings | object | yes | Page load times; see below. |
comment | string | no | A comment (new in 1.2). |
pageTimings
| Field | Type | Required | Meaning |
|---|---|---|---|
onContentLoad | number | no | Milliseconds from the page’s start until its content was loaded (the DOMContentLoaded event or readyState “interactive”, depending on the browser); −1 when it does not apply. |
onLoad | number | no | Milliseconds from the page’s start until the load event; −1 when it does not apply. |
comment | string | no | A comment (new in 1.2). |
The draft does not say in words that the first four fields of a page are required; it simply does not mark them optional, which is how it shows required fields throughout.
Example
{
"log": {
"version": "1.2",
"creator": { "name": "WebInspector", "version": "537.36" },
"pages": [
{
"startedDateTime": "2023-11-14T22:13:20.123Z",
"id": "page_1",
"title": "https://example.com/",
"pageTimings": { "onContentLoad": 412.5, "onLoad": 980.2 }
}
],
"entries": [ … ]
}
}