Skip to content

Commit

Permalink
Add note about ProgressEvent.loaded reporting different values depe…
Browse files Browse the repository at this point in the history
…nding on the browser (#32781)
  • Loading branch information
Zwyx authored Mar 21, 2024
1 parent b68a1e0 commit 76c3857
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions files/en-us/web/api/progressevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ The **`ProgressEvent`** interface represents events measuring progress of an und
_Also inherits properties from its parent {{domxref("Event")}}_.

- {{domxref("ProgressEvent.lengthComputable")}} {{ReadOnlyInline}}
- : A boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. In other words, it tells if the progress is measurable or not.
- : A boolean flag indicating if the ratio between the size of the data already transmitted or processed (`loaded`), and the total size of the data (`total`), is calculable. In other words, it tells if the progress is measurable or not.
- {{domxref("ProgressEvent.loaded")}} {{ReadOnlyInline}}
- : A 64-bit unsigned integer value indicating the amount of work already performed by the underlying process. The ratio of work done can be calculated by dividing `total` by the value of this property. When downloading a resource using HTTP, this only counts the body of the HTTP message, and doesn't include headers and other overhead.
- : A 64-bit unsigned integer indicating the size, in bytes, of the data already transmitted or processed. The ratio can be calculated by dividing `ProgressEvent.total` by the value of this property. When downloading a resource using HTTP, this only counts the body of the HTTP message, and doesn't include headers and other overhead. Note that for compressed requests of unknown total size, `loaded` might contain the size of the compressed, or decompressed, data, depending on the browser. As of 2024, it contains the size of the compressed data in Firefox, and the size of the uncompressed data in Chrome.
- {{domxref("ProgressEvent.total")}} {{ReadOnlyInline}}
- : A 64-bit unsigned integer representing the total amount of work that the underlying process is in the progress of performing. When downloading a resource using HTTP, this is the `Content-Length` (the size of the body of the message), and doesn't include the headers and other overhead.
- : A 64-bit unsigned integer indicating the total size, in bytes, of the data being transmitted or processed. When downloading a resource using HTTP, this value is taken from the `Content-Length` response header. It only counts the body of the HTTP message, and doesn't include headers and other overhead.

## Instance methods

Expand Down
10 changes: 5 additions & 5 deletions files/en-us/web/api/progressevent/loaded/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ browser-compat: api.ProgressEvent.loaded

{{APIRef("XMLHttpRequest API")}}

The **`ProgressEvent.loaded`** read-only property is an integer
representing the amount of work already performed by the underlying process. The ratio
of work done can be calculated with the property and `ProgressEvent.total`.
When downloading a resource using HTTP, this value is specified in bytes (not bits), and only represents the part of the content
itself, not headers and other overhead.
The **`ProgressEvent.loaded`** read-only property is a 64-bit unsigned integer
indicating the size, in bytes, of the data already transmitted or processed. The ratio can be calculated by dividing `ProgressEvent.total` by the value of this property.
When downloading a resource using HTTP, this only counts the body of the HTTP message, and doesn't include headers and other overhead.

Note that for compressed requests of unknown total size, `loaded` might contain the size of the compressed, or decompressed, data, depending on the browser. As of 2024, it contains the size of the compressed data in Firefox, and the size of the uncompressed data in Chrome.

## Value

Expand Down
9 changes: 4 additions & 5 deletions files/en-us/web/api/progressevent/total/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ browser-compat: api.ProgressEvent.total

{{APIRef("XMLHttpRequest API")}}

The **`ProgressEvent.total`** read-only property is an unsigned
64-bit integer value indicating the total size of the data being processed or
transmitted. In the case of an HTTP transmission, this is the size of the body of the
message (the `Content-Length`), and does not include headers and other
overhead.
The **`ProgressEvent.total`** read-only property is a 64-bit unsigned integer
indicating the total size, in bytes, of the data being transmitted or processed.

When downloading a resource using HTTP, this value is taken from the `Content-Length` response header. It only counts the body of the HTTP message, and doesn't include headers and other overhead.

If the event's {{domxref("ProgressEvent.lengthComputable", "lengthComputable")}}
property is `false`, this value is meaningless and should be ignored.
Expand Down

0 comments on commit 76c3857

Please sign in to comment.