Why am I seeing a 404 (Not Found) error failed to load favicon.ico when not using this?

HtmlIis

Html Problem Overview


Synopsis

After creating a simple HTML template for testing purpose, with no favicon.ico, I receive an error in the console "Failed to load resource: the server responded with a status of 404 (Not Found)" | "http://127.0.0.1:47021/favicon.ico";.

I am trying to figure out where this error is coming from and wondered if someone had any ideas to point me in the right direction.

My HTML page looks like this:

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Simple JavaScript Tester 01</title>
</head>
<body>

<script src="script.js"></script>
</body>
</html>

When I run this page in Chrome browser and open the console, I see the error message "Failed to load resource: the server responded with a status of 404 (Not Found)" | "http://127.0.0.1:47021/favicon.ico";. I am running this on a local IIS server. I see this same error message each time I create a new page.

Is it possible this error is coming from another page on my IIS server that I am unaware of?

Html Solutions


Solution 1 - Html

By adding this to the header section, you will definitely remove the error in the console log:

<link rel="shortcut icon" href="">

From Chrome 2020 this is the solution :

<link rel="shortcut icon" href="#">

Solution 2 - Html

Because your browser always looks for the favicon.ico even if you don't specify it within your HTML.

So I'd suggest just creating one and placing it in the root of your website.

Solution 3 - Html

Google favicon generator and make an icon. Name it favicon.ico and drop it in your webroot.

See if this helps.

Also here is a tutorial on favicon: https://www.w3.org/2005/10/howto-favicon

Solution 4 - Html

You can add this to your <head> tag

<link rel="shortcut icon" href="#">

Works for me

Solution 5 - Html

   <link rel="shortcut icon" href="~/favicon.ico">

You can't actually stop browsers requesting the image. However if you do have a favicon it can be cached by the browser which can reduce the number of requests coming in. so if you have the favicon in the root folder of the application the link above should work

Solution 6 - Html

It's nothing but an icon on your tab bar. This is the main point. You can also use any icon for your local file. However, the format for the image you have chosen must be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit colors. For more information please read this documentation: https://www.w3.org/2005/10/howto-favicon.

Solution 7 - Html

It is an old issue apparently, but since I'm just starting to learn coding...

I had the same favicon issue, both with FF and Chrome and unfortunately, none of the suggestions here helped.

Even when I have the "javascript.ico" file in my folder

<link rel="icon" href="javascript.ico" type="image/x-icon" />

this still wouldn't be able to find the icon, so the problem remained.

However, the following helped remove this error message:

just change the ".ico" extension of, both your file and in the HTML code into for example ".png"... problem solved, icon found.

<link rel="icon" href="javascript.png" type="image/x-icon" />

And after doing this, even if you change back the extension into ".ico", it'll still work and the error won't return.

Solution 8 - Html

I have faced the issue with using Angular. I have moved favicon.ico from src folder to assets/img and changed href in link tag in index.html:

<link rel="icon" type="image/x-icon" href="assets/img/favicon.ico">

Also I have removed src/favicon.ico from angular.json builder options.

Solution 9 - Html

It seems pretty lame, but the thing that works for me is that I just reload the page and the browser doesn't show any error.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJohn SmithView Question on Stackoverflow
Solution 1 - Htmlpollux1erView Answer on Stackoverflow
Solution 2 - HtmlJack MarchettiView Answer on Stackoverflow
Solution 3 - HtmlmakadusView Answer on Stackoverflow
Solution 4 - HtmlCostZView Answer on Stackoverflow
Solution 5 - HtmlDavid FawzyView Answer on Stackoverflow
Solution 6 - Htmlafzzal__mahmudView Answer on Stackoverflow
Solution 7 - HtmlpolygonStormView Answer on Stackoverflow
Solution 8 - HtmlTomislav BrabecView Answer on Stackoverflow
Solution 9 - HtmlSoham MafidarView Answer on Stackoverflow