Baseline Widely available
The error
event is fired when the resource could not be loaded due to an error (for example, a network connectivity problem).
This event is not cancelable and does not bubble.
SyntaxUse the event name in methods like addEventListener()
, or set an event handler property.
addEventListener("error", (event) => { })
onerror = (event) => { }
Event type
A generic Event
.
const video = document.querySelector("video");
const videoSrc = "https://path/to/video.webm";
video.addEventListener("error", () => {
console.error(`Error loading: ${videoSrc}`);
});
video.setAttribute("src", videoSrc);
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3