Live data from Hacker News

The complexity of downloading favicons

simplecto.com

31–39 of 39 posts

Re: The complexity of downloading favicons

#33

Favicons can be TIFF? Browsers don't have support for TIFF—for one, libtiff has historically been a huge source of security vulnerabilities. What pages have TIFF favicons?

I had a list of 500 domains that I used for testing when originally developing. To be clear I don't recall seeing tiff files loaded in browsers, but I definitely remember seeing them downloaded and crashing my code.

I wrote favicon-getter just as a means to populate an icon next to a list of links in another project. Hence, all the references to Yak-shaving.

In the end I just assumed that I would "almost" never see a tiff used as favicon and move on.

Re: The complexity of downloading favicons

#34
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?

ICO files can have an alpha channel or a bit mask.

Re: The complexity of downloading favicons

#35
post #32

favicons? Try scraping the page title of a random link The consistent problem for me is that cloudflare doesnt like (some/certain/it seems random) ip ranges or user agents and pops up a captcha immediately

Have you tried proxy-rotation services like Crawlera? This is on my radar if I encounter too many issues.

https://scrapinghub.com/crawlera

Re: The complexity of downloading favicons

#37

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.

It's actually relatively easy using a media-query in CSS: https://css-tricks.com/dark-mode-favicons/

Re: The complexity of downloading favicons

#39
post #21

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.

This is an annoying downside of dark mode, which I tend to have enabled on everything all the time: Favicons often don't look good (github, circleci...). Also many slack emoji don't show up. I don't know if there's a good solution to this. It's unfeasible to require developers to provide two icons, particularly in places that are mothballed. Should browsers always render favicons against a light/white background?

It's not really a problem of dark vs. light, it's the fact that transparency in a generic logo is a pretty bad idea. I'm not sure what transparency is supposed to solve that an explicitly designed color wouldn't.
Post reply on HN