Tutorials References Exercises
Log in
Buy Courses

HTML onprogress Attribute


Definition and Usage

The onprogress attribute defines a script to be run when the browser is downloading the specified audio/video.

During the loading process of an audio/video, the following events occur, in this order:

  1. onloadstart
  2. ondurationchange
  3. onloadedmetadata
  4. onloadeddata
  5. onprogress
  6. oncanplay
  7. oncanplaythrough

Applies to

The onprogress attribute is part of the Event Attributes, and can be used on the following elements:

Elements Event
<audio> progress
<video> progress

Examples

Audio Example

Run "myFunction" when the audio file is being downloaded:

<audio onprogress="myFunction()">
Try it Yourself »

Video Example

Run "myFunction" when the video is being downloaded:

<video onprogress="myFunction()">
Try it Yourself »

Browser Support

The onprogress attribute has the following browser support for each element:

Element
audio Yes 9.0 Yes Yes Yes
video Yes 9.0 Yes Yes Yes