How do I set an icon for a website?

For some reason, in the head section of the HTML document, I wrote:

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

I placed the file "favicon.ico " in the folder, but still the icon is not displayed!

Someone tell me what the reason is, please.

 0
Author: meine, 2012-11-04

6 answers

Well, first of all, we need to make sure that icon/favicon. ico is the right path to the icon. Well, if everything is in order, then the browser is to blame, i.e. the cache. It's happened before. But try to cheat, it helps in both cases, as the page code changes.

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

Or so (set an absolute path)

<link rel="shortcut icon" href="/icon/favicon.ico">
 2
Author: void, 2012-11-04 17:11:13

What server do you have? If you are an Apache, then kinte favicon. ico in the root of the site and you will be happy.

 0
Author: kandi, 2012-11-04 17:06:25

Try it like this:
<link rel="icon" href="./icon/favicon.ico" type="image/x-icon">

 0
Author: Alexander Kartsev, 2019-01-21 15:30:30

Currently, to simply insert an icon, it is enough to write 1 line as already mentioned above and upload the file to the server. But there are many scenarios in which the usual favicon does not solve the tasks set, in addition to the answers, I can recommend a service that will easily prepare your image for all popular platforms.

Https://realfavicongenerator.net/

 0
Author: lazyproger, 2019-04-16 04:45:57

I always insert in the following way (usually I put it in the root of the site, the same place and index.html or index.php:

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

Many search engines and browsers themselves search for this icon in the root of the site named favicon

In your case, the code should be like this (if you specify a relative path):

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

Yes, I use two strings with different rel= "" attributes. This has historically happened because of browsers and their "tug-of-war"

And the icon may not be displayed if you have the format is specified incorrectly. For example, to make an icon in the FSH and save it as. ico for some reason does not always work. I make icons in FSH, save them as jpg and then use the IcoFX program to convert them to. ico for several years and everything works fine.

 -1
Author: alex Roosso, 2019-04-16 04:39:50

I also had this problem. In short, you throw the icon to the root of the site(I don't know if it is necessary or not, but I have it so), you write it (With such brackets I don't know how to put them link rel= "shortcut icon" href= " favicon. ico" NOW! You restart your server. I have an Open Server there everything is simple you do not know how

 -3
Author: klonwar, 2015-02-23 10:40:31