antipatternperformance

legacy-image-formats

This policy controls the ability of the document to render images in legacy image formats. These are defined as any format other than JPEG, PNG, GIF, WEBP, or SVG. In documents in which this policy is disallowed, legacy-format images will be rendered with inverted colours.

How to apply this policy

Send the following HTTP header to control the legacy-image-formats policy, and disallow it on all origins:

Feature-Policy: legacy-image-formats 'none'

Affected use case example

HTML

<img
        src='/test-assets/small-image.bmp'
        width="150" height="150"
      />

Output

Loading...

Waiting for the demo to report a result...

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 legacy-image-formats policy is:

Mozilla Firefox

Not supported

Google Chrome

68+

Microsoft Edge

Not supported

Apple Safari

Not supported

Discussion