--- title: ProgressEvent slug: Web/API/ProgressEvent translation_of: Web/API/ProgressEvent ---
{{APIRef("DOM Events")}}
The ProgressEvent
interface represents events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest
, or the loading of the underlying resource of an {{HTMLElement("img")}}, {{HTMLElement("audio")}}, {{HTMLElement("video")}}, {{HTMLElement("style")}} or {{HTMLElement("link")}}).
ProgressEvent
event with the given parameters.Also inherits properties from its parent {{domxref("Event")}}.
unsigned long long
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 only represent the part of the content itself, not headers and other overhead.unsigned long long
representing the total amount of work that the underlying process is in the progress of performing. When downloading a resource using HTTP, this only represent the content itself, not headers and other overhead.Also inherits methods from its parent {{domxref("Event")}}.
ProgressEvent
created using the deprecated {{domxref("Document.createEvent()", "Document.createEvent(\"ProgressEvent\")")}} method.The following example adds a ProgressEvent
to a new {{domxref("XMLHTTPRequest")}} and uses it to display the status of the request.
var progressBar = document.getElementById("p"), client = new XMLHttpRequest() client.open("GET", "magical-unicorns") client.onprogress = function(pe) { if(pe.lengthComputable) { progressBar.max = pe.total progressBar.value = pe.loaded } } client.onloadend = function(pe) { progressBar.value = pe.loaded } client.send()
Specification | Status | Comment |
---|---|---|
{{SpecName('Progress Events', '#interface-progressevent', 'ProgressEvent')}} | {{Spec2('Progress Events')}} | Initial definition. |
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | {{CompatGeckoDesktop("1.9.1")}} | 10.0 | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
initProgressEvent() {{non-standard_inline}}{{deprecated_inline}} |
{{CompatNo}}[1] | {{CompatNo}}[2] | 10.0 | {{CompatNo}}[4] | {{CompatNo}}[3] |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("1.9.1")}} | 10.0 | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
initProgressEvent() {{non-standard_inline}}{{deprecated_inline}} |
{{CompatNo}}[3] | {{CompatNo}} | {{CompatNo}}[2] | 10.0 | {{CompatNo}}[4] | {{CompatNo}}[3] | {{CompatNo}} |
[1] This feature was implemented in Chrome 1.0, but removed in Chrome 17.0.
[2] This feature was implemented in Gecko 1.9.1 {{geckoRelease("1.9.1")}}, but removed in Gecko 22 {{geckoRelease("22")}}.
[3] This feature was removed at some point.
[4] This feature was removed in Opera 15.0.