1

From internet I get to know that some browser pick first favicon to display and some pick last favicon , when multiple favicons are present.

My usecase is when first favicon is not available fallback to fallback favicon. So used something like this

 <link rel="shortcut icon" href="firstFavicon" />
 <link rel="shortcut icon" href="fallbackFavicon" /> 
 <link rel="shortcut icon" href="firstFavicon" />

But in one use case it is not picking firstFavicon in chrome,edge and safari. firstFavicon is .ico file of size 256 * 256 , fallback favicon is .ico of size 48 * 48

  • Could you describe your use case? Why the first favicon might not be available? – philippe_b Mar 30 '21 at 13:22
  • the reason favicon not available beacuse i am creating that favicon at runtime .. /favicon.ico . fallback icon will always be present there btw. – Ritesh Kumar Mar 31 '21 at 12:29
  • It would be more elegant to handle this situation server-side, by returning the "best" icon available (the one generated at runtime, of the default one). Yet, I understand this is not always possible or convenient. About your solution: although it looks correct, it is brittle. You need to test it on all major browsers and OS. And that might change someday... The solution I think of is to apply the default icon, and use JS to change it to the best one, only if available. Heavy, but should work. For example see https://stackoverflow.com/questions/260857/changing-website-favicon-dynamically – philippe_b Apr 01 '21 at 13:15
  • yes to check where domain favicon present or not , I need to do GET request to verify which will increase latency of page :-( – Ritesh Kumar Apr 02 '21 at 04:21

0 Answers0