antipattern

unsized-media

The unsized-media policy controls whether documents are allowed to resize images to their 'natural' size.

When a document contains images or videos without explicit dimensions, the size is determined by reading the image data. This takes time, and therefore causes the document layout to change when the image dimensions become known. When a document is disallowed to use unsized-media with this policy, its <img>, <video>, and <svg:image> elements will adopt a default size (300px X 150px) and will not change size when the image data is loaded, providing a potentially less juddery user experience during page load.

How to apply this policy

Send the following HTTP header to control the unsized-media policy, and disallow it on all origins:

Feature-Policy: unsized-media '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 unsized-media policy is:

Mozilla Firefox

Not supported

Google Chrome

66+

Microsoft Edge

Not supported

Apple Safari

Not supported

Discussion