everytime favicon loads, browser loading old one initially and then new one

Viewed 20

In my rails app, I am managing two favicons based on a condition.

Below is the code in my application layout

- if <condition>
  = favicon_link_tag "favicon1.ico"
- else
  = favicon_link_tag "favicon2.ico"

Its working fine as per condition but when I switch from favicon1 to favicon2, on page load browser loading favicon1 initially and then loading favicon2, and same is happending whenever favicon is loading in browser.

  1. Browser: Chrome
  2. Version: 105.0.5195.102 (Official Build) (x86_64)
  3. Browser is not sending two requests
  4. Browser cache enabled, but even if I disable it, issue still occurs.

My suspicion is that, when I click on any link in my app, browser is requesting for favicon, until the response comes back, browser loads previous favicon and once the response comes back, loads the correct favicon.

Browser is not requesting favicon everytime when I click a link but it's calling randomly and requesting frequently on few links.

Is there a way to stop browser from requesting favicon unless it's a whole page load?

0 Answers
Related