Why do I even need favicon to prevent server errors? And, why the default is .ico?
Pacharapol Withayasakpunt

Pacharapol Withayasakpunt @patarapolw

About: Currently interested in TypeScript, Vue, Kotlin and Python. Looking forward to learning DevOps, though.

Location:
Thailand
Joined:
Oct 30, 2019

Why do I even need favicon to prevent server errors? And, why the default is .ico?

Publish Date: Oct 13 '21
11 2

Do I even need /favicon.ico for http://localhost or Electron?

Right now? I use 1px PNG (not ICO) at /f/favicon.png (not at /, but at /f/). I think it is at least better than using a a short string of data URI (where Fastify Helmet or Express Helmet won't allow).

pip install pillow
python -c 'from PIL import Image;Image.new("RGBA", (1,1), color=(0,0,0,0)).save("favicon.ico", sizes=[(1,1)])'
Enter fullscreen mode Exit fullscreen mode

Comments 2 total

  • JoelBonetR 🥇
    JoelBonetR 🥇Oct 15, 2021

    favicon is meant to add information to the user about whether a browser tab or a saved URL (as desktop icon) contains. It's a good practice to have one and it needs to be placed on the root directory of your project with the name favicon.ico, because it's a web standard.

    Inside your root HTML you can set up multiple icons as well, targeting specific devices like 'apple-touch-icon' or simply 'icon'.

  • Nicholas Bilyk
    Nicholas BilykOct 15, 2021

    +1 it's silly that favicon.ico is considered required.
    There's also an online ico creator (heavily ad supported)
    favicon.io/

    I haven't seen your 1px solution before. I like it. Although isn't there also a size requirement for favicon.ico? I thought they were supposed to be 16x16 or something like that.

Add comment