antipattern

font-display-late-swap

This policy controls the ability of a document to use the auto, block, and swap values of the font-display CSS property. If the policy is disallowed for the current document, then any elements with a font-display that is not fallback or optional will be set to optional.

It's annoying for users when fonts take a long time to load, rendering a page unreadable even though the text is available ('blocking'). Not quite as bad, but still a jarring user experience, is when a fallback font is used and the element is rerendered in the webfont when it is available ('swapping'). Disabling the font-display-late-swap policy prevents both of these effects by giving the webfont a very small window of opportunity to load, and if it doesn't load in time, simply not using it at all and continuing to use the fallback instead.

How to apply this policy

Send the following HTTP header to control the font-display-late-swap policy, and disallow it on all origins:

Feature-Policy: font-display-late-swap 'none'

Does it work?

Currently Firefox, and Chromium based browsers, such as Google Chrome, Samsung Internet, and Opera, are the only user-agents to support Feature Policy. The minimum version that correctly recognises the font-display-late-swap policy is:

Mozilla Firefox

Unknown

Google Chrome

74+

Microsoft Edge

Not supported

Apple Safari

Not supported

Discussion