HTML Audio/Video DOM error Event

❮ HTML Audio/Video DOM Reference

Example

//Accessing the element
var vid = document.getElementById("myVideo");

//Creating a function
vid.onerror = function() {
    alert("Error! Something went wrong");
};

Meaning

The error event run when an error occurred during the loading of an audio/video.


Standard Syntax

HTML:

<element onerror="myScript">

JavaScript:

object.onerror=function(){myScript};

JavaScript, using the addEventListener() method::

object.addEventListener("error", myScript);



Browser Support




Status







Technical Details

Type Description
Supported HTML tags: <audio> and <video>
Supported JavaScript objects: Audio, Video
❮ HTML Audio/Video DOM Reference