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

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

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

Someone tell me the reason, please.

  • Track network queries with a debugger. There you will see the error. - sorx00
  • What browser do you have? - artuska

6 answers 6

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

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

or so (set the absolute path)

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

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

    • I have a denwer, so when I downloaded the icon, I didn’t appear as much as I did. Appeared in three days - a week ... So here, time is the best assistant) - sinedsem 5:48

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

    • one
      As the commentator wrote from the bottom: "Ochchchen timely response." - meine

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

      I always insert as follows (usually I put it in the root of the site, in the same direction as 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 are looking for this icon in the root of the site called favicon

      In your case, the code should be such (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 lines with different rel = "" attributes. This happened historically because of the browsers and their "blanket pulling"

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

        I also had such a problem. In short, you throw an icon into the root of the site (I don’t know if it’s necessary or not, I’ll do it), you prescribe (I don’t know how to put these brackets <> how to put them link rel = "shortcut icon" href = "favicon.ico" NOW! me Open Server there everything just you do not know how

        • 2
          Ochchchen timely response! - zhenyab