|
@mathias | |||||
|
🎉 Chrome now supports SVG favicons! chromium-review.googlesource.com/c/chromium/src…
Pro tip: you don’t need any HTML to declare a favicon. Host your SVG file at /favicon.ico and serve it with the correct MIME type (image/svg+xml). mathiasbynens.be/notes/rel-shor… 🤯
|
||||||
|
||||||
|
Nathan Gathright
@NathanG
|
19. stu |
|
Since you can put CSS in an SVG, would a `prefers-color-scheme: dark` media query be enough for dark mode support?
|
||
|
|
||
|
Mathias Bynens
@mathias
|
20. stu |
|
Test case: numerous-sulfur.glitch.me The media query is ignored.
@jaffathecake had an interesting write-up on how media queries behave in SVG across browsers: jakearchibald.com/2016/svg-media… This behavior seems to follow from that.
|
||
|
|
||
|
Axel Rauschmayer
@rauschma
|
19. stu |
|
Genuine question: Pro tip or a hack that happens to work? Doesn’t seem like a best practice to me(?)
|
||
|
|
||
|
Mathias Bynens
@mathias
|
19. stu |
|
Which part exactly? All browsers request /favicon.ico by default (see link in tweet for my old write-up). And file extensions don’t matter on the web; MIME types do. I see nothing wrong with this.
|
||
|
|
||
|
Kilian Valkhof
@kilianvalkhof
|
19. stu |
|
I didn't even realise Chrome didn't support it. It was a no-brainer when I implemented support for them in @polypane.
|
||
|
|
||
|
Mathias Bynens
@mathias
|
19. stu |
|
The lack of support bothered me everytime I browsed to a @WHATWG spec. Well, not anymore! 👍
|
||
|
|
||
|
David Anson
@DavidAns
|
19. stu |
|
Is the recommendation to use server-side browser sniffing to know when SVG is supported, or is there a clean way to statically return ICO/PNG/SVG in a way that lets the browser choose?
|
||
|
|
||
|
Mathias Bynens
@mathias
|
20. stu |
|
The static solution is to use <link rel="icon" type="…">.
For a server-side solution, browser sniffing seems overkill for this purpose. If we could tweak the Accept header Chrome sends for such requests, it might be easier: bugs.chromium.org/p/chromium/iss…
|
||
|
|
||
|
Xavier Perseguers
@xperseguers
|
20. stu |
|
What I dislike is that ICO file format is originally a container for BMP and PNG. So having a favicon.ico served with mime-type image/svg+xml sounds semantically wrong to me ^^
|
||
|
|
||
|
Mathias Bynens
@mathias
|
20. stu |
|
Both URLs in my tweet don't have any extensions at all. The same goes for the Twitter URL of this very tweet. Is that semantically wrong too?
It's just a URL. Extensions don't matter on the web; MIME types do.
|
||
|
|
||