Question

I am a newbie in rails.

I had put a new favicon.ico in my public folder and deleted the old one.

I have also written a code wherein I have to use the new icon for eg:-

  <link rel="icon" type="image/x-icon" href="favicon.ico" />
  <%= favicon_link_tag 'favicon.ico' %>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">

  <%  user_agent = request.env['HTTP_USER_AGENT'] %>
  <%  if /Windows/.match(user_agent).nil? %>
      <%= stylesheet_link_tag    "application", :media => "all" %>
      <%= stylesheet_link_tag    "application2", :media => "all" %>
  <%  else %>
      <% if user_agent.include? "Safari" and !user_agent.include? "Chrome" %>
          <%= stylesheet_link_tag    "safariwindows", :media => "all" %>
          <%= stylesheet_link_tag    "safariwindows2", :media => "all" %>
      <% else %>
          <%= stylesheet_link_tag    "windowsapplication", :media => "all" %>
          <%= stylesheet_link_tag    "windowsapplication2", :media => "all" %>
      <% end %>
  <% end %>

  <%= javascript_include_tag "application" %>

  <!--[if gte IE 7]>
      <%= stylesheet_link_tag    "ie", :media => "all" %>
    <![endif]-->
  <%= stylesheet_link_tag '/video-js/video-js.min' %>
  <%= javascript_include_tag '/video-js/video.min' %>
  <%= javascript_include_tag 'http://j.maxmind.com/app/geoip.js' %>
  <%= csrf_meta_tags %>
  <script>
      pki = "<%= session[:pki] %>"
  </script>

I have also cleared cache and also tried in incognito mode but still not working.

Can anyone give any solutions.

Was it helpful?

Solution 2

Try this -

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

OTHER TIPS

Make sure name of the icon is favicon and try this erb tag under <head> tag in application.html.erb layout, Put your icon in app/assets/images/ and not in public folder.

Remove

<link rel="icon" type="image/x-icon" href="favicon.ico" />

and add

<%= favicon_link_tag 'favicon.ico' %>

Store your icon image in app/assets/images/favicon.ico folder. then wherever you want generally in application layout file under the app/view/layouts

put this code

<%= favicon_link_tag 'favicon.ico' %>

check this link for more details

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top