Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4 favicon issue

Trying to add a favicon to my rails app, but doesn't seem to be working locally. Heres my code

Aplication.html.erb (in the head section)

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

Note: Favicon has been saved within my asset/images folder and the icon is 64x64 pixel

Is there anything thats been done wrong here?

Thanks in advance

like image 651
Samuel Avatar asked Mar 29 '14 20:03

Samuel


3 Answers

I think the address should be without the slash:

<%= favicon_link_tag 'favicon.ico' %>
like image 80
Ole Henrik Skogstrøm Avatar answered Oct 08 '22 12:10

Ole Henrik Skogstrøm


The proper use of favicon_link_tag is the immediate solution:

<%= favicon_link_tag 'favicon.ico' %>

However, a single favicon.ico can only address most desktop browsers. Mobile browsers can't cope with it but need higher resolution icons, like the Touch icon for iOS devices. You can get support for all browsers with RealFaviconGenerator:

  • Go to RealFaviconGenerator and submit your picture. You can edit your icons platform-per-platform (Android, iOS...).
  • When the icons are ready, follow the instructions.

The instructions are clear enough to setup the favicon, so there will be no path issue, no "extra slash" issue, etc.

Full disclosure: I'm the author of this site.

like image 27
philippe_b Avatar answered Oct 08 '22 12:10

philippe_b


Using rails 4.2.3, in my /public folder there was already a favicon. I simply replaced that and DID NOT ADD <%= favicon_link_tag 'favicon.ico' %>. Worked perfectly.

Weird thing is I first tried with the favicon_link_tag and that somehow prevented the favicon from showing up.

like image 36
Mirror318 Avatar answered Oct 08 '22 12:10

Mirror318