Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Favicon in React will not Update

I cannot update the favicon in react boilerplate.

I replaced the file in images/app/favicon.ico with my own file, but I'm still seeing the old icon show up.

I cleared my browser cache, ran npm run build:clean, and npm run build.

Can't get my new favicon to render. Please advise how to update the favicon.

like image 825
Liver Avatar asked Aug 23 '18 21:08

Liver


People also ask

Why is my favicon not updating?

You will have to delete your cache from your browser, close your browser and reopen it. That should fix it. I don't believe your favicons will get refreshed on your favorites until you revisit that page, and assuming that you had previously cleared your browsers cache.

How long does it take for favicon to update?

For the most part it seems like most SEOs said it takes around 24 hours, sometimes less. The guidelines specifically say "Google will look for and update your favicon whenever it crawls your home page.


1 Answers

The problem is that the browser is holding onto the old image in the cache and not updating it.

To solve this problem update the favicon url to %PUBLIC_URL%/favicon.ico?v=2

The ?v=2 at the end will force the browser to refresh the favicon.

See How do I force a favicon refresh? for more details.

like image 158
Mr. J Avatar answered Sep 19 '22 23:09

Mr. J