FontFaceSet.onloadingerror

The onloadingerror EventHandler of the FontFaceSet interface processes loadingerror events.

The loadingerror event fires when fonts have finished loading, but some or all fonts have failed to load.

Syntax

FontFaceSet.onloadingerror = function;
FontFaceSet.addEventListener('loadingerror', function);

Example

In the following example, if the font Ephesis fails to load, "Font loading error" is printed to the console.

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
onloadingerror
35
79
41
No
22
10
4.4.3
35
41
22
Yes
3.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/onloadingerror