0

enter image description here

enter image description here

I'm working on a local server and trying to add a simple favicon. I have already searched high and low on these forums, and tried everything. I'm not sure what is going wrong.

This is the code I have inserted into the head of my code:

<link href="http://www.canwise.com/favicon.ico" rel="shortcut icon" type="image/x-icon"/>

my favicon image is in the same folder as my html file for this page. I haven't even put it in an images folder.

Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
  • Have you seen [this answer](https://stackoverflow.com/a/61218702/11934850)? Which Browser do you use, see [problems with edge](https://stackoverflow.com/q/33081965/11934850). – Sascha Doerdelmann Jul 28 '22 at 14:46

1 Answers1

0

First of all, please read the typical w3sfoundation example:

W3-Schools - HTML Favicon

Please note, that in this example the path starts with /

The / means, that the icon is relative to the root directory of the webpage. So if you are opening for example:

/subpages/guestbook.php

and your favicon is located at: /favicon.ico you also need to write it that way. Otherwise it will try to open: /subpages/favicon.ico

Please also define the type: <link rel="icon" type="image/x-icon" href="/images/favicon.ico">

You also need to keep in mind, that localhost often works different from an online webpage. Please open the browser developer tools using and look at networking. Clear all and reload the page. You should se an entry, that tries to load the favicon. If it cannot be loaded, you will find the reason there. If it works, you will see a 200 GET (HTTP SUCCESS). If not, the error code will help you find the source of favicon not loading properly.

If you find no entry for the favicon at all, please run your HTML/PHP through one or more linting tools. Sometimes a slight syntax error will result in very specific HTML features breaking. From the picture, your HTML looks good so far.