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
I think the address should be without the slash:
<%= favicon_link_tag 'favicon.ico' %>
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:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With