Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get `favicon.ico` error, but can not find it in the code

Tags:

webstorm

When I run my project in browser I get the "can not find favicon.ico" error in browser console:

Failed to load resource: the server responded with a status of 404 (Not Found)
:8080/favicon.ico

enter image description here

But when I search for favicon in whole project in WebStorm it finds nothing:

enter image description here

like image 574
sof-03 Avatar asked Apr 09 '18 02:04

sof-03


People also ask

How do I fix favicon not found?

Wrong file path You need to ensure that your favicon's file path is correct. If you have your icon in the images folder, then make sure that your file path has /images/favicon. ico depending on what you named your icon.

Where is the favicon located in code?

Favicons are declared in the <head> tag of a web page.

Can I use PNG instead of ico for favicon?

A favicon can actually be either a PNG, GIF, or ICO file. However, ICO files are typically used more than others as the file size is smaller and it is supported in all major browsers. PNGs are used more commonly for IOS, Android, and Windows 10 devices.


2 Answers

This is normal. No matter if you declared it or not in your code, Chrome will try will try to fetch favicon.ico at the root of your site to display it in your tab. In your case it will try to fetch: http://localhost:8080/favicon.ico

All browsers will do this except SeaMonkey according to Wikipedia article on Favicon

In the old days, this was the standard way of personalizing the browser icon. Now there is a ton of possible icons you can set for various devices: https://stackoverflow.com/a/26768184/1375487

Also, you can check this answer as it suggests ways to prevent that auto-fetch: https://webmasters.stackexchange.com/a/34572

In any case, the best practice would be to set a favicon.ico for your project.

like image 134
tlebel Avatar answered Oct 16 '22 01:10

tlebel


favicon.ico is the icon on the title bar in your website.

Browser did not find it in your website.

You should provide it to your index.html:

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

The path you can change by your case.

like image 22
aircraft Avatar answered Oct 16 '22 02:10

aircraft