Live data from Hacker News

The complexity of downloading favicons

simplecto.com

11–20 of 39 posts

Re: The complexity of downloading favicons

#11

16: Sometimes it is an animated gif. That's so funny, I've never seen one moving. Do browsers just convert the first frame into a static icon on the fly when they're downloaded or have I just never noticed one moving?

You can even control them with JavaScript which... well, see the game for yourself:

http://www.p01.org/defender_of_the_favicon/

(Press N to start, the arrow keys to move.)

Re: The complexity of downloading favicons

#12
post #9

17: sometimes there are multiple sizes, according to the spec ( https://html.spec.whatwg.org/multipage/links.html#rel-icon ) 18: sometimes favicons are not square 19: sometimes favicons have transparent pixels (GIF) or an alpha channel (PNG)

Good ones! I forgot about the transparent pixels. May I add those with credit to you?

My pleasure, go ahead :)

Re: The complexity of downloading favicons

#13

16: Sometimes it is an animated gif. That's so funny, I've never seen one moving. Do browsers just convert the first frame into a static icon on the fly when they're downloaded or have I just never noticed one moving?

They’re just not common, that’s all. Most browsers support them (not sure about Chrome, but I believe all the rest do), and even if the browser nominally doesn’t, you can change the favicon dynamically in JavaScript to achieve the same effect (think how some services change their favicon to show an unread count or “new message” indicator, and then start doing that repeatedly—though when the tab is in the background, that’ll probably only net you 1fps).

Re: The complexity of downloading favicons

#15

I remember having similar issues a few years ago, I think I ended up using a google service to capture favicons (can't seem to find it anymore) EDIT: Found it! https://www.google.com/s2/favicons?domain= (simply add a domain name after '=' and it will return the website favicon)

I came here to post this same tip.

"https://www.google.com/s2/favicons?domain=news.ycombinator.c... />"

Re: The complexity of downloading favicons

#17

I remember having similar issues a few years ago, I think I ended up using a google service to capture favicons (can't seem to find it anymore) EDIT: Found it! https://www.google.com/s2/favicons?domain= (simply add a domain name after '=' and it will return the website favicon)

Funny how google keeps this service around indefinitely but will kill off any number of other services :-) Though, I'm sure this is much cheaper to keep the lights on vs. something like Wave (RIP) or Plus.

Re: The complexity of downloading favicons

#18
Another recent complication is serving different favicons for browsers running a dark mode. For example, somehow nytimes.com inverts theirs on my browser and it actually looks great. Sites need to be aware that a dark icon over a transparent background will be invisible in dark mode.

Re: The complexity of downloading favicons

#19
post #4

Chromium favicon service for comparison: https://github.com/chromium/chromium/tree/master/components/...

So much code for what ideally ought to be a simple task!

I glanced over it quickly. A lot of the code files are really small, a couple of lines each. The rest is a mixture of actual logic, boilerplate and integration overhead (mostly due to a lot of event based asynchronous task handling). The overhead comes with the territory when integrating something into a big codebase such as a browser. The business rules are still a few 100 lines, though.

Re: The complexity of downloading favicons

#20

I remember having similar issues a few years ago, I think I ended up using a google service to capture favicons (can't seem to find it anymore) EDIT: Found it! https://www.google.com/s2/favicons?domain= (simply add a domain name after '=' and it will return the website favicon)

I came here to post this same tip. " https://www.google.com/s2/favicons?domain=news.ycombinator.c... />"

Be advised... while this img tag is ok for embedding, clicking on the link in HN reveals an extra quote character.
Post reply on HN