I had never used a favicon for a site before.  I just added one to my upcoming quizical.net site. I ran into one small problem that I thought I would add here.

I created a 16 x 16 icon, named it favicon.ico and added it to my public folder (not public/images). Yet, the icon was not showing up in my browser.

Some poking around revealed that I must add the following between my document head:

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

Once I added that, it works fine. Easy.



4 Responses to “Rails and favicon.ico”  

  1. 1 Jess

    Can I ask which document you inserted the code into? I keep placing it into my header.php doc but it isn’t showing up.

    Appreciate it in advance.

    Thanks!

  2. 2 steveodom

    Hi Jess,

    These instructions are far a rails application. It sounds like your app is php. To answer your question though, I put the above link in my main layout file.

  3. 3 costa

    hi!
    it wouldn’t work if you’re using resources in your project.
    in this case you have to generate url relativ to the resource.

  4. 4 tim

    Thanks for this tip! That worked for my app. Strangely, my favicon showed up in the development environment without me having to do this - I only needed to do it in production…

    Any ideas why that would be?

Leave a Reply