How to prevent favicon error?

Asked

Viewed 134 times

0

Every time I go up the local server the message from

Error 404! Favicon.ico is not found

How do I make this mistake without putting any image in html.

Obs: I didn’t write that I was looking for Favincon at the head.

  • 1

    Have you cleared the cache? Tested in another browser? Are you sure I don’t have any script injecting this Favicon into the document? I already inspect the page by Devtools to see if the Favicon tag is in the head?

  • 1

    Placing an image file of "icone" format in the root folder with the name favicon.ico... this error occurs because the browser EVEN WITHOUT <link> will try to load a possible favicon.ico. cc @hugocsl

  • Or remove the favicon.ico statement that might be in some manifest file or in some <head tag>

  • @Leandroangelo is native to browsers like Chrome (Chromium) and Firefox.

1 answer

4


It’s natural to do that in browsers, when you don’t have the <link rel="icon" ...>, browser will try to load a possible from the root favicon.ico, ie, the attempt to load a possible favicon is precisely to help the tabs, windows, history and bookmarks are better identified (visually) by the end user.

Example, I created a index.html emptiness:

<html>
<body></body>
</html>

And I started a local http server and downloaded this HTML:

Firefox força carregar favicon.ico

How to avoid 404 message when you don’t have a favicon

One way to solve it is by creating a empty image 1px by 1px type icon, or png, or gif at the root of your server (whether local or remote).

Or else use the data URI scheme emptiness this way in all your HTML pages:

<link rel="icon" href="data:,">

The reason for favicon.ico be loaded from the root when omitted in HTML is probably due to a historical issue, more specifically in Internet Explorer 5.01, 5.5 and 6 (in Netscape and Opera at the time I can’t remember if they had needs or if I had support), at that time the bookmaker (favorite) was very used and some sites could not load the icon in bookmaker or even display in address bar, then someone did the test put on the root and point also with <link rel="icon" ... and it worked, but I think that was a mistake, because it seems to me that the reason to get at the root was because people confused the relative path of the icon when browsing a subfolder/suburl and suggested to keep at the root to avoid problems.

What I remember very well is that in Internet Explorer 6 favicons never worked properly, they only worked for real when added to the bookmarker and if I remember they didn’t work on every page, it was something half-assed, different from IE7 onwards, that this was "fixed".

This situation specifies the behavior of favicon in the versions of Internet Explorer, 5.01, 5.5 and 6 are not officially documented, the operation I explained was after DIVERSE tests I did at the time that these browsers were on the rise (specifically the 6, but always did some tests to ensure backward compatibility).

I just told you this whole history of these browsers that no one’s used for a long time to explain the possibility of modern browsers automatically trying to load favicon from the root of the site, this probably remained due to a backward compatibility issue so that several sites would not break, so browsers force use of the root when omitted in HTML, to facilitate user guidance through tabs, regardless of which page you browse.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.