Favicon shows up on rails local, not on hosted app

大憨熊 提交于 2020-01-04 04:03:14

问题


I put my favicon.ico in my public folder, and it shows up on my localhost, but when I check it out on the internet,

shows up instead. My app is hosted through heroku, and the domain is provided by hover. Where is this failing?

Also, in case this helps, here is the code I'm using to render the favicon:

<!DOCTYPE html>
<html>
  <head>
    <link rel="shortcut icon" href="/favicon.ico" />
    <title>Shoulak Predictions</title>
    <%= stylesheet_link_tag    'application', media: 'all' %>
    <%= javascript_include_tag 'application' %>
    <%= csrf_meta_tags %>
    <%= render 'layouts/shim' %>    
  </head>
  <body>
    <%= render 'layouts/header' %>
    <div class="container">
      <% flash.each do |key, value| %>
        <div class="alert alert-<%= key %>"><%= value %></div>
      <% end %>
      <%= yield %>
    </div>
    <div class="container">
        <%= render 'layouts/footer' %>
        <%= debug(params) if Rails.env.development? %>
    </div>
  </body>
</html>

Update

If I go to mydomain.com/favicon.ico, I do download the favicon that I uploaded. ALSO, if I go to therealapp.herokuapps.com, it shows up. I think somehow my domain provider may be providing their own?


回答1:


Adding a random number in your favicon will force the update:

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



回答2:


Once I cleared my browser cache, the favicon showed up.




回答3:


I've found that it takes time for that change to show up. Something to do with browser caches or server settings or something.




回答4:


I was doing Hover forwarding, not using the DNS features. Hover automatically uses their own favicon.



来源:https://stackoverflow.com/questions/15562173/favicon-shows-up-on-rails-local-not-on-hosted-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!