SVG
The error event is fired when an SVG element does not load properly or when an error occurs during script execution.
This basically implements the standard error DOM event.
This event is not cancelable.
Syntax
Use the event name in EventTarget/addEventListener:
addEventListener("error", (event) => { })
Alternatively, assign to the event handler property of the interface:
onerror = (event) => { }
Event type
A generic Event.
Examples
svgElem.addEventListener("error", () => {
console.log("SVG not loaded properly.");
});
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
