Open Bug 1603885 Opened 5 years ago Updated 11 months ago

allow media="" to affect <link rel=icon>

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: heycam, Unassigned)

References

Details

Per the HTML spec, the media attribute on a <link> element must apply for any link type that is an external resource reference, which includes rel=icon.

Some authors are working around lack of this support by watching for media feature changes in script: https://dev.to/rumkin/smart-web-design-part-i-light-dark-mode-favicon-31f0

Priority: -- → P3

It seems that the media attribute already affects favicon <link> elements in Firefox today, at least on macOS where I’ve tested this.

Test page: https://media-link.glitch.me/

<link rel="icon" href="https://via.placeholder.com/144/ff0000">
<link rel="icon" media="(prefers-color-scheme: dark)" href="https://via.placeholder.com/144/000000">
<link rel="icon" media="(prefers-color-scheme: light)" href="https://via.placeholder.com/144/ffffff">

Notice how the favicon is always white in Firefox, regardless of the operating system’s color scheme. If Firefox doesn’t read the media attribute, the favicon should be red, like it is in Safari. This looks like a bug.

Severity: normal → S3
Severity: normal → S3
See Also: → 1790109
You need to log in before you can comment on or make changes to this bug.