View video tutorial

HTML onemptied Attribute

HTML

The HTML onemptied attribute is an event handler that triggers a script to execute when the media element is unexpectedly reset to an empty state or the media data suddenly becomes unavailable.

Definition and Usage


➔ This can happen in the following situations:

  • A fatal error occurred during the loading process.
  • The media source unexpectedly disconnects or becomes unavailable.
  • The load() method is called to reload the media after it has already been loaded or is partially loaded.

➔ This event is not cancelable and is not propagated through the DOM.

Applies to

This attribute can be used on the following element.

Attribute Element
onemptied <audio>, <video>