← Back to release summary

Honor media HTML attribute for link icon

Category
DOM
Type
New or changed feature
Status
Enabled by default (Chrome 91)
Intent stage
Shipped

Summary

The link element’s “media” attribute will be honored for link[rel="icon"] so that web developers can define multiple equally appropriate icons based on a media query (dark and light modes for instance). The last one that matches will be picked. Browsers don’t currently honor the media attribute for link[rel="icon"] even though the HTML specification says they should.

Motivation

This is a known and acknowledged bug in Chrome.

Standards & signals

Samples: https://media-link.glitch.me

Explainers: N/A

View on chromestatus.com