The loadingerror
event fires when fonts have finished loading, but some or all fonts have failed to load.
On this page
FontFaceSet: loadingerror event
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("loadingerror", (event) => {});
onloadingerror = (event) => {};
Example
In the following example, if the font Ephesis
fails to load, "Font loading error" is printed to the console.
js
document.fonts.onloadingerror = () => {
console.log("Font loading error");
};
(async () => {
await document.fonts.load("16px Ephesis");
})();
Specifications
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
loadingerror_event |
35 | 79 | 41 | No | 22 | 10 | 37 | 35 | 41 | 22 | 10 | 3.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/loadingerror_event