ProgressEvent

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Note: This feature is available in Web Workers.

The ProgressEvent interface represents events that measure the progress of an underlying process, like an HTTP request (e.g., an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>).

Event ProgressEvent

Constructor

ProgressEvent()

Creates a ProgressEvent event with the given parameters.

Instance properties

Also inherits properties from its parent Event.

ProgressEvent.lengthComputable Read only

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.

ProgressEvent.loaded Read only

A number indicating the size of the data already transmitted or processed. For a ProgressEvent dispatched by the browser in HTTP messages, the value refers to the size, in bytes, of the message body, excluding headers and other overhead. In compressed messages of unknown total size, loaded might refer to the size of the compressed or uncompressed data, depending on the browser. As of 2024, it contains the size of the compressed data in Firefox, and the uncompressed data in Chrome. In a ProgressEvent you create yourself, you can assign any numeric value to loaded that represents the amount of work completed relative to the total value.

ProgressEvent.total Read only

A number indicating the total size of the data being transmitted or processed. For ProgressEvents dispatched by the browser in HTTP messages, the value refers to the size, in bytes, of a resource and is derived from the Content-Length header. In a ProgressEvent you create yourself, you may wish to normalize total to a value such as 100 or 1 if revealing the precise amount of bytes of a resource is a concern. If using 1 as a total, for example, then loaded would be a decimal value between 0 and 1.

Instance methods

Inherits methods from its parent, Event.

Examples

Showing the status of a request

The following example adds a ProgressEvent to a new XMLHttpRequest and uses it to display the status of the request.

js
const progressBar = document.getElementById("p"),
  client = new XMLHttpRequest();
client.open("GET", "magical-unicorns");
client.onprogress = (pe) => {
  if (pe.lengthComputable) {
    progressBar.max = pe.total;
    progressBar.value = pe.loaded;
  }
};
client.onloadend = (pe) => {
  progressBar.value = pe.loaded;
};
client.send();

Using fractions in a ProgressEvent

The total number of bytes of a resource may reveal too much information about a resource, so a number between 0 and 1 may be used in a ProgressEvent() instead:

js
function updateProgress(loaded, total) {
  const progressEvent = new ProgressEvent("progress", {
    lengthComputable: true,
    loaded,
    total,
  });

  document.dispatchEvent(progressEvent);
}

document.addEventListener("progress", (event) => {
  console.log(`Progress: ${event.loaded}/${event.total}`);
});

updateProgress(0.123456, 1);

Specifications

Specification
XMLHttpRequest
# interface-progressevent

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
ProgressEvent
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 3.5 (Release date: 2009-06-30)
footnote Full support
Opera – Full support
Opera 12.1 (Release date: 2012-11-20)
footnote Full support
Safari – Full support
Safari 3.1 (Release date: 2008-03-18)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 12.1 (Release date: 2012-10-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 2 (Release date: 2008-07-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 2 (Release date: 2008-07-11)
footnote Full support
Deno – Full support
Deno 1.3 (Release date: 2020-08-13)
footnote Full support
ProgressEvent() constructor
Chrome – Full support
Chrome 16 (Release date: 2011-12-13)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 18 (Release date: 2013-01-08)
footnote Full support
Opera – Full support
Opera 12.1 (Release date: 2012-11-20)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 18 (Release date: 2013-01-08)
footnote Full support
Opera Android – Full support
Opera Android 12.1 (Release date: 2012-10-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
Deno – Full support
Deno 1.3 (Release date: 2020-08-13)
footnote Full support
loaded and total options accept doubles
Chrome – Full support
Chrome 136 (Release date: 2025-04-29)
footnote Full support
Edge – Full support
Edge 136 (Release date: 2025-05-01)
footnote Full support
Firefox – Full support
Firefox 138 (Release date: 2025-04-29)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Preview support
Safari TP
footnote
footnote See bug 288688
footnote Preview browser support
Chrome Android – Full support
Chrome Android 136 (Release date: 2025-04-29)
footnote Full support
Firefox for Android – Full support
Firefox for Android 138 (Release date: 2025-04-29)
footnote Full support
Opera Android – Full support
Opera Android 90 (Release date: 2025-06-18)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 29 (Release date: 2025-10-25)
footnote Full support
WebView Android – Full support
WebView Android 136 (Release date: 2025-04-29)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
Deno – No support
Deno
footnote No support
lengthComputable
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 3.5 (Release date: 2009-06-30)
footnote Full support
Opera – Full support
Opera 12.1 (Release date: 2012-11-20)
footnote Full support
Safari – Full support
Safari 3.1 (Release date: 2008-03-18)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 12.1 (Release date: 2012-10-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 2 (Release date: 2008-07-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 2 (Release date: 2008-07-11)
footnote Full support
Deno – Full support
Deno 1.3 (Release date: 2020-08-13)
footnote Full support
loaded
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 3.5 (Release date: 2009-06-30)
footnote Full support
Opera – Full support
Opera 12.1 (Release date: 2012-11-20)
footnote Full support
Safari – Full support
Safari 3.1 (Release date: 2008-03-18)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 12.1 (Release date: 2012-10-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 2 (Release date: 2008-07-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 2 (Release date: 2008-07-11)
footnote Full support
Deno – Full support
Deno 1.3 (Release date: 2020-08-13)
footnote Full support
total
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 3.5 (Release date: 2009-06-30)
footnote Full support
Opera – Full support
Opera 12.1 (Release date: 2012-11-20)
footnote Full support
Safari – Full support
Safari 3.1 (Release date: 2008-03-18)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 12.1 (Release date: 2012-10-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 2 (Release date: 2008-07-11)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 2 (Release date: 2008-07-11)
footnote Full support
Deno – Full support
Deno 1.3 (Release date: 2020-08-13)
footnote Full support
Available in workers
Chrome – Partial support
Chrome 47 (Release date: 2015-12-01)
footnote Partial support
footnote Available in dedicated workers and shared workers, not available in service workers. See bug 332663431.
Edge – Partial support
Edge 79 (Release date: 2020-01-15)
footnote Partial support
footnote Available in dedicated workers and shared workers, not available in service workers. See bug 332663431.
Firefox – Full support
Firefox 54 (Release date: 2017-06-13)
footnote Full support
Opera – Partial support
Opera 34 (Release date: 2015-12-08)
footnote Partial support
footnote Available in dedicated workers and shared workers, not available in service workers. See bug 332663431.
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Partial support
Chrome Android 47 (Release date: 2015-12-02)
footnote Partial support
footnote Available in dedicated workers and shared workers, not available in service workers. See bug 332663431.
Firefox for Android – Full support
Firefox for Android 54 (Release date: 2017-06-13)
footnote Full support
Opera Android – Partial support
Opera Android 34 (Release date: 2015-12-16)
footnote Partial support
footnote Available in dedicated workers and shared workers, not available in service workers. See bug 332663431.
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Partial support
Samsung Internet 5 (Release date: 2016-12-15)
footnote Partial support
footnote Available in dedicated workers and shared workers, not available in service workers. See bug 332663431.
WebView Android – Partial support
WebView Android 47 (Release date: 2015-12-02)
footnote Partial support
footnote Available in dedicated workers and shared workers, not available in service workers. See bug 332663431.
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
Deno – No support
Deno
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
In development. Supported in a pre-release version.
In development. Supported in a pre-release version.
No support
No support
See implementation notes.

See also

  • The Event base interface.