Put your favorite icon on the website root folder of the website

I need to put favicon.ico outside the root of the website. Can I put it in another way or can the old browser punish me?

+4
source share
2 answers

If you put favicon.ico in another directory and declare it in HTML (for example, <link rel="shortcut icon" href="/icon/favicon.ico"> ) , favicon will work , including on IE5, the first Browser for icon support. However, you will encounter the following (minor) disadvantages:

  • IE (and perhaps some others) will look for /favicon.ico no matter what. Expect 404 errors in the logs of your HTTP server.
  • Some browsers, such as Chrome, will use favicon.ico , even if you also declare high resolution PNG images favicon. Of course, if you use favicon.ico only as an icon, this is not a problem.

In general, it is good practice to put the entire favicon-related file in the root directory of the website. For more details see http://realfavicongenerator.net/faq#why_icons_in_root (full disclosure: I am the author of this page).

+4
source

Some browsers will always check for favicon.ico in the root folder. Do not break anything if it is missing.

+3
source

Source: https://habr.com/ru/post/1481760/


All Articles