4

Am using Ruby-on-Rails 3.1. I have placed my favicon.ico in a public folder. Then I included the link in my layout file as follows:

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

I also tried,

<%= favicon_link_tag '/favicon.ico'%>

In Chrome it is getting displayed in development, but not in production.

In Firefox it is not getting displayed in both development or production.

I cleared the cache also. I know it is asked many times in this site itself, but still nothing works for me could any help me in this?

John Willemse
  • 6,608
  • 7
  • 31
  • 45
Abhiram
  • 1,459
  • 14
  • 23
  • Can you track the actual http request for the favicon.ico, for example with httpfox for Firefox or fiddler2? So you can check, if the resource is really available ... you'll get the real url and you can see, if the image is loaded from the server or browser cache ... – Stefan Brendle May 08 '13 at 06:53
  • You can use Fiddler2 for this, you can see what is happening on your internet line – Leroy Meijer May 08 '13 at 08:14
  • Many possible problems. You need to do some more research. http://blog.55minutes.com/2012/02/untangling-the-rails-asset-pipeline-part-3-configuration/ http://stackoverflow.com/questions/8616016/favicon-not-displayed-by-firefox-i-know-its-been-asked-10000-times?rq=1 etc. etc. Don't expect us to redo all that work for you. – Old Pro May 08 '13 at 08:17
  • ya stephen i can track with http request.. image is coming properly but i couldnt get on tabs.. – Abhiram May 08 '13 at 09:22

3 Answers3

0

Is your favicon.ico file valid? In particular, did you take a PNG picture and renamed it to favicon.ico?

ICO is a specific format, different of PNG and JPG. Yet, Chrome is smart enough to figure this out and process it correctly. But you can still expect strange behaviors on different browsers.

philippe_b
  • 38,730
  • 7
  • 57
  • 59
0

Not exactly sure why it worked but I went into config/initializers/assets.rb and changed

    Rails.application.config.assets.version = '1.0'

to

   Rails.application.config.assets.version = '1.1'

and my favicon appeared

Zippo9
  • 706
  • 2
  • 5
  • 24
0

This is an old question but in this situation it is always worth running rake assets:precompile when something like this is not working.

Also worth mentioning that the <%= favicon_link_tag %> generates a different location based on environment, local vs production.

These two things tripped me up.

Paul Harker
  • 166
  • 2
  • 14