Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Favicon not showing in Chrome v64.0.3282.186 #366

Closed
summera opened this issue Feb 27, 2018 · 8 comments
Closed

Favicon not showing in Chrome v64.0.3282.186 #366

summera opened this issue Feb 27, 2018 · 8 comments

Comments

@summera
Copy link

summera commented Feb 27, 2018

Using Turbolinks 5.0.1 with Rails 5.1.4. I've also tested Turbolink 5.1.0.

On initial page load, the favicon shows just fine in Chrome tabs. However, on subsequent loads when pages are loaded with XMLHttpRequest via Turbolinks, the favicon disappears and turns into a blank page.

screen shot 2018-02-27 at 3 33 29 pm

I'm not seeing this behavior on Firefox. I'm also not seeing this behavior on Basecamp in Chrome v64.0.3282.186. So I'm wondering if anyone else is seeing this and/or if you've found a workaround with Basecamp?

@jeremy
Copy link
Member

jeremy commented Feb 27, 2018

Are you seeing a request for the favicon (in the dev tools Network tab) after a page load?

Perhaps related to #187, #273.

@summera
Copy link
Author

summera commented Feb 28, 2018

@jeremy thanks for the quick response. Good thinking. I actually do not see this request in Firefox (where everything works fine) or Chrome but I don't see that request even on the first page load or when I remove Turbolinks and the favicon displays correctly. I do see the request in Safari with or without Turbolinks. I think Crome and Firefox are filtering this request out. To confirm this, I made a simple html file:

<html>
  <head>
    <link rel="shortcut icon" type="image/x-icon" href="[link_to_some_favicon]">
  </head>
</html>

And loaded this in the browser. Indeed Chrome and Firefox don't show this request but do display the favicon. Chrome will show the request if it fails which can be tested by using a bogus href.

screen shot 2018-02-27 at 7 12 18 pm

My favicon HTML rendering looks like the following:

<%= favicon_link_tag "/favicon.ico" %>
<%= favicon_link_tag "/apple-touch-icon.png", rel: "apple-touch-icon" %>
<% %w(76 120 152 180).each do |size| %>
  <%= favicon_link_tag "/apple-touch-icon-#{size}x#{size}.png", rel: 'apple-touch-icon', sizes: "#{size}x#{size}" %>
<% end %>

I've found two ways to get the favicon to display correctly in Chrome:

  1. remove turbolinks
  2. remove the use of apple-touch-icons and only have <%= favicon_link_tag "/favicon.ico" %>

Number 2 seems very weird to me and I'm not sure why this would be but as crazy as it sounds, removing the apple-touch-icons makes the favicon display correctly even when Turbolinks takes over. This does not seem related to #187 or #273.

@vronin
Copy link

vronin commented Mar 1, 2018

+1. Just stumbled on the same problem. (BTW. I observe exactly the same behavior and the work around is the same - to remove "apple-touch-icons", which is truly weird)

@summera
Copy link
Author

summera commented Mar 1, 2018

@vronin I also realized that placing the apple touch icons above the favicon fixes it as well. Still not sure as to why. Very odd 😕

<%= favicon_link_tag "/apple-touch-icon.png", rel: "apple-touch-icon" %>
<% %w(76 120 152 180).each do |size| %>
  <%= favicon_link_tag "/apple-touch-icon-#{size}x#{size}.png", rel: 'apple-touch-icon', sizes: "#{size}x#{size}" %>
<% end %>

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

@vronin
Copy link

vronin commented Mar 1, 2018

@summera Thanks. This worked for me too. (I will use it as workaround right now.) However, whole this bug is beyond odd.

@zzemla
Copy link

zzemla commented Mar 12, 2018

+1 - the same issue - removing the apple touch icon helped as a workaround, placing them above or below the favicon as suggested by @summera did not have any effect for me.

@lsaville
Copy link

lsaville commented Apr 4, 2018

+1 for @summera's solution.

@domchristie
Copy link
Collaborator

Very odd issue! (and nice work @summera for finding a workaround!) Closing this for now, as it seems to be more of a browser bug than an issue with how Turbolinks merges in <head> elements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants