1668

I have a Grails application running locally using its own tomcat and I have just changed the favicon for a new one. Problem is that I can not see it in any browser. The old favicon shows up or I get no favicon at all, but not my new one. I do not think this is a Grails issue per se, more an issue with favicons.

What is supposed to happen with favicons? How are they supposed to work? I have numerous bookmarks in my browser which have the wrong icons and they never seem to get refreshed. How do I force the server/browser to stop caching them? It seems pretty silly to always cache them given they are normally only 16x16. Why not just upload them with every visit to the page? It is not exactly a huge overhead.

Nic3500
  • 8,144
  • 10
  • 29
  • 40
Simon
  • 78,655
  • 25
  • 88
  • 118
  • 15
    The accepted and highly upvoted solution is NOT the real solution. The actual reason why refresh won't work can be found in this question's solution: http://stackoverflow.com/questions/8616016/favicon-not-displayed-by-firefox-i-know-its-been-asked-10000-times --- the icon cache is in a sqlite DB file, independent of the browser cache! – Mörre Jan 17 '15 at 15:16
  • 10
    The accepted and highly upvoted solution is solution for production, or do shall I write tutorial for users how to clear their favicon cache when ever we update favicon for production? – Miroslav Saracevic Nov 12 '15 at 09:43
  • 2
    Is not a general solution. What if you are using favicon default location without touching your code? That is, a `favicon.ico` file in your document root. – Sebastian Oct 13 '16 at 02:49
  • 10
    https://xkcd.com/1854/ – sudo bangbang Aug 17 '18 at 04:37
  • If anyone's wondering: Chromium have decided not to fix this one, and instead require that related history entries and bookmarks are removed: https://bugs.chromium.org/p/chromium/issues/detail?id=440322 – thephpdev Mar 07 '22 at 16:56
  • I'm not convinced you should be forcing a refresh. Browsers cache stuff for a reason, and if you break the browser's cacheing, then that's BAD (tm). For testing purposes, just clear the cache. For production purposes, just let their cache expire and they'll get the new favicon in due course. – xpusostomos Jul 20 '22 at 09:02

34 Answers34

2229

To refresh your site's favicon you can force browsers to download a new version using the link tag and a query string on your filename.
This is especially helpful in production environments to make sure your users get the update.

<link rel="icon" href="http://www.yoursite.com/favicon.ico?v=2" />
Mahozad
  • 18,032
  • 13
  • 118
  • 133
Mark
  • 22,462
  • 1
  • 15
  • 9
  • 39
    This did the trick for me. I had to remove `type="image/x-icon"` from my code, contrary to many sources. I used a file modified timestamp for the `v?=2` part of the query. – Wertisdk Mar 26 '12 at 11:06
  • The Chrome browser will still display the wrong favicon when the page containing this link tag is loaded from cache. The user must manually refresh the page, or the page must be dropped from cache before visiting, for the favicon to update. – MetaEd May 16 '12 at 20:58
  • 10
    I have found that in some browsers the favicon did no tupdate no matter what unless I deleted the history. Then it will save the new favicon. – pathfinder Mar 22 '13 at 03:51
  • 6
    Unfortunately you need the fully-qualified absolute URL for IE7 (&IE8?) - see http://jeffcode.blogspot.com.au/2007/12/why-doesnt-favicon-for-my-site-appear.html – eug Apr 24 '13 at 11:11
  • 1
    presumably this technique will fall foul of the problem with many (most?) common proxies (by default) not caching any URLs with query strings? – simon Jul 16 '13 at 03:29
  • 5
    agree with the above comments, but this works for me in all current browsers: – Dave Sumter Aug 18 '13 at 07:47
  • Can I use the same for the Drupal logo as well? My Drupal logo too is not being replaced in some of the systems. – Raj Pawan Gumdal Aug 19 '13 at 08:18
  • 2
    @Raj Yes. This technique can be used anywhere a file is being referenced: css files, js files, img tags, css background images, etc. – Mark Aug 30 '13 at 13:35
  • 1
    @VanjaD. I don't think he meant a current time stamp I think he meant a timestamp of the last time it was edited/changed. Makes a lot of sense! – Bill Jul 30 '14 at 10:17
  • You dont even need to update the query param from my testing. faviconPath += '?v=1' is sufficient to update it everytime. – Taylor Rose Feb 02 '15 at 17:54
  • @VanjaD. Simply having a query string will cause it to be re-fetched every time anyway, as there's no way to override the cache-ability of a .ico, and the default behaviour is to not cache pages which have a query string. – NickG Mar 12 '15 at 11:22
  • 1
    You can also change the `href` (add the `?v=someval`) in your developer tools without refreshing the page. This only affects your browser, not other visitors to your website. Mostly good for development uses. – DACrosby Mar 28 '15 at 17:09
  • @DACrosby I just independently discovered that you can change the `href` live as well - I've posted it as a new answer, and developed a script for it (so it *will* affect visitors to your website): http://stackoverflow.com/a/30655908/34799 – Stuart P. Bentley Jun 04 '15 at 23:33
  • 3
    +1 This is just insane, half an hour waste of time, you think something is wrong first on backend while verifying application paths , you refresh browsers caches like crazy. And then solution like this works. Why browsers are retarded to cache something like that where even cache clearing does not help... (rhetorical) – Aubergine Nov 11 '15 at 00:45
  • 44
    It makes sense to cache favicons because they sometimes push 2-3 kilobytes in size. You don't want to keep transferring all that data. (yes, sarcasm) – Flat Cat Dec 12 '15 at 13:54
  • 2
    Or just `[...].ico?2` - it's sufficient. I also store this number as a constant somewhere and just apply it to all resources of a distinct type. e.g. `CssVersion`, `JsVersion`, etc. – bytecode77 Jun 23 '16 at 16:14
  • 1
    Using Firefox, so far this has only changed the tab favicon. It hasn't changed the favicon under my bookmarks or history, even if i delete then then add the bookmark again. – Scott Jul 21 '16 at 11:19
  • 2
    This is a helpful technique to know for clearing cache of browsers who have visited the site of your production server, but for local development purposes, it's also helpful to realize that you can visit example.com/favicon.ico and press `Ctrl+Shift+R` several times. :-) http://stackoverflow.com/questions/2208933/how-do-i-force-a-favicon-refresh#comment62580011_2208982 – Ryan Feb 17 '17 at 23:13
  • doesn't answer the question of how to refresh the favicon – Laurence Cope Jul 05 '18 at 13:30
874

Adapted from lineofbird's answer beloew, you can do the following:

  1. Go directly to the favicon url in the address bar by typing in its address e.g.

    • www.yoursite.com/favicon.ico
    • www.yoursite.com/apple-touch-icon.png
    • etc.
  2. Navigate to the url by pressing Enter

  3. Refresh with Ctrl+F5

  4. Restart your browser (e.g. Chrome, Firefox)

isherwood
  • 58,414
  • 16
  • 114
  • 157
alex
  • 8,909
  • 1
  • 14
  • 2
  • For the record, do not ctr+f5 if working in a VM on ubuntu, you will siwtch ttys. you will need to ctr+f? where ? is the right number to get back your gui. – TheoretiCAL Apr 16 '14 at 23:34
  • what about shift+F5 or http://stackoverflow.com/questions/12633425/chrome-browser-reload-options-new-feature – Muhammad Umer Jul 17 '14 at 01:14
  • I found that just visiting the favicon in the web browser (http://example.com/favicon.ico) and refreshing once to see the new favicon worked in Chrome. – kingjeffrey Jul 25 '14 at 19:21
  • 15
    Using this method you probably would overcome the caching, but your existing users cannot. Hence, I find the other answer more valuable. – Demircan Celebi Oct 02 '14 at 13:24
  • 3
    Worth noting that this doesn't work in Firefox 33. First answer is a better choice. – Brent Waggoner Nov 10 '14 at 16:43
  • 1
    I had to close dev tools to make this work in Chrome. – tehwalris Oct 07 '15 at 23:22
  • Worked in Firefox 43.0.4 on Mac OS X; just `F5` worked for me. – orbeckst Jan 16 '16 at 00:57
  • 1
    I didn't have to restart the browser, but I did have to navigate to my website in a tab without devtools open. For some reason, Ctrl+F5'ing in a non-devtools tab did it. I could Ctrl+F5 all I wanted and navigate all over the internet and back to my site as much as I wanted in the devtools tab and it wouldn't ever update the favicon. – mejdev Mar 23 '16 at 01:29
  • 1
    Still wtf'ing, does not work for me with Chrome 54 in Windows 7. – Hinrich Nov 09 '16 at 13:25
  • 3
    The "restart browser" part was the only thing that actually made it work for me. All the other fixes work in theory, but don't actually change the favicon pixels displayed on the browser tab. +1 this answer – b264 Feb 14 '17 at 20:48
  • 1
    Chrome 56: worked like a charm! Albeit, it did not work in incognito mode. – Travis Clarke Mar 08 '17 at 07:28
  • Chrome 61/Sierra/localhost:4201 - not working. This answer is what I first do whenever dealing with cache. However, the icon had updated in the browser, but not in tab label - where it's supposed to be seen. – tishma Oct 31 '17 at 12:06
  • So the solution is to fix your own browser and just let other people who visit the site figure it out on their own.. – Tyler Rafferty Mar 21 '18 at 07:16
  • Ctrl+F5 worked for me in Firefox 112. – Robot Head May 04 '23 at 21:07
265

In current version of chrome (on OSX) if you do the following you will get an instant favicon refresh:

  1. Hover over tab
  2. Right Click
  3. Select reload
  4. Your favicon should now be refreshed

This is the easiest way I've found to refresh the favicon locally.

isherwood
  • 58,414
  • 16
  • 114
  • 157
Garry Polley
  • 4,253
  • 1
  • 22
  • 29
64

By destroying the file your browser uses to store old favicons, you can force new ones to be loaded.

  1. Close your browser. Make sure there are no longer browser processes running (e.g. check Task Manager for chrome.exe or firefox.exe).
  2. Navigate to where your browser stores user files:
  3. Delete the favicon cache.
    • For Chrome, remove Favicons and Favicons-journal
    • For Firefox, remove favicons.sqlite

This will almost definitely work. If not:

  • Possibility 1: An update to your browser has changed how the favicon cache works. Please edit this answer with new instructions.
  • Possibility 2: Your favicon problem has nothing to do with overaggressive caching. It may instead be a resource-loading problem – using Developer Tools, make sure the new favicon is downloading properly.
MultiplyByZer0
  • 6,302
  • 3
  • 32
  • 48
konzo
  • 1,973
  • 22
  • 32
  • This did the trick. For me, this was a Google Chrome application favicon issue. Not a DOM favicon issue. – klewis May 04 '16 at 15:03
  • 2
    This is a good answer that meets my needs for testing. There is no one real answer for this question because it depends on who needs to refresh it and what they are willing and able to reasonably do. – Dovev Hefetz Jan 05 '17 at 08:44
  • 2
    Just a little improvement: that same path for any username is `%appData%/../Local/Google/Chrome/User Data/Default` – josemmo Aug 13 '17 at 10:07
  • 5
    An easier solution in Chrome is to right click and select Inspect (or CTRL+SHIFT+I), then click and hold the refresh button. A menu will appear with the option to Refresh, Hard Reload, or Empty Cache and Hard Reload. Usually Hard Reload will do it, but if it's stubborn for some reason, Empty Cache and Hard Reload definitely will. – felwithe Nov 01 '17 at 16:12
  • 1
    On Linux you can find these files at: `~/.config/google-chrome/Default` – Arnold Schrijver Sep 12 '18 at 10:54
  • The path of the Firefox favicon cache file is (in Windows): `C:\Users\\AppData\Roaming\Mozilla\Firefox\Profiles\et1ewsrn.default-release\favicons.sqlite`. – Mustafa Özçetin Jul 09 '23 at 09:25
60

Rename the favicon file and add a link in the HTML head element with the new name, such as:

<link rel="SHORTCUT ICON" href="http://www.yoursite.com/favicon2.ico" />
isherwood
  • 58,414
  • 16
  • 114
  • 157
Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
  • 4
    I would assume browser can see if favicon name is the same. If it is it won't request its download again and will use one already cached, but if you change the name it will assume it has changed thus requesting it from the server. – Bojan Kogoj Aug 19 '11 at 03:49
  • I had the problem with the IE8. It didn't use the favicon.ico placed in a subfolder. Adding the rel-attribute 'shortcut' fixed it. – tienbuiDE Nov 21 '13 at 13:33
  • 3
    Thats not refreshing at all, its changing it to a new one completely. – Zac Feb 04 '16 at 18:13
  • please note that you have to rename your actual favicon.ico as well (it will be in your build folder or the directory from which the webapp is being served) – Rahil Ahmad Jan 17 '18 at 06:50
60

If you use PHP you could also use the MD5-Hash of the favicon as a query-string:

<link rel="shortcut icon" href="favicon.ico?v=<?php echo md5_file('favicon.ico') ?>" />

This way the Favicon will always refresh when it has been changed.

As pointed out in the comments you can also use the last modified date instead of the MD5-Hash to achieve the same thing and save a bit on server performance:

<link rel="shortcut icon" href="favicon.ico?v=<?php echo filemtime('favicon.ico') ?>" />
Felix Wienberg
  • 921
  • 12
  • 19
  • 2
    Nice, this avoids the need to change the href everytime i update the favicon, this answer should have more votes ! – Sven van den Boogaart Dec 27 '14 at 22:35
  • 47
    The problem with this answer is that you are calculating that hash on every request, and that's something unnecessary and might hurt the sites performance (if lots of users). – Diego Jancic Jan 08 '15 at 19:39
  • 1
    It's not that big of a deal in both sense... a favicon is only a couple of kilobytes... I mean, it won't be less stress on the server than having to server the favicon each time... – Philippe Gilbert Feb 04 '15 at 15:35
  • 17
    I still don't see any real reason to calculate the MD5. It's easier and just as effective to use the file's last modified date. I see no advantage of using the MD5 over the last modified stamp. – NickG Mar 12 '15 at 11:26
  • @DiegoJancic As every website uses caching nowadays I don't think this is much of an impact. You can switch to CRC32b if you want, which should be even faster. But still we're talking about microseconds here. – flu Mar 11 '16 at 10:32
  • Good answer. The last modified time is also preferable because it will change only when the favicon file changes and so allow a browser to use its cached version instead of an additional request being sent (more significant than the tiny file size). But nobody would ever notice the difference anyway. – Nick Rice Apr 13 '16 at 09:41
  • 9
    How often are you really updating your favicon? This seems like overkill. Just use the manual query string when you make a new icon. – zeros-and-ones Jul 14 '16 at 20:38
  • Size optimization `href="favicon.ico?` I remove `v=` characters from link xD – Kamil Kiełczewski Mar 15 '18 at 12:51
35

In Chrome on Mac OS X one can remove file with favicon cache

${user.home}/Library/Application Support/Google/Chrome/Default/Favicons 
Maxim Mazin
  • 3,816
  • 1
  • 21
  • 15
  • 1
    This solution worked for me. For some reason, it was not refreshing the favicon with above mentioned methods with far more votes. So thank you, Maxim Mazin. I only wanted to get rid of an old favicon that I knew couldn't exist anymore on my new host. – tsaulic Jun 26 '14 at 05:53
  • 2
    This approach also worked for me on Windows, where I had removed the favicon from my app, but chrome was still showing it. Close Chrome, delete "C:\Users\{user}\AppData\Local\Google\Chrome\User Data\Default\Favicons", then restart Chome. The old unwanted favicon is gone. – skomisa Sep 15 '15 at 06:14
  • 2
    I had nothing under "Default" but eventually I found this variation: `${user.home}/Library/Application Support/Google/Chrome/Profile 1/Favicons` – mdahlman Apr 08 '17 at 01:01
  • @mdahlman This didn't initially work for me after trying all the other methods. However I got this one to work after `cmd+q`ing chrome, going to the menu bar, force quitting chrome again and waiting 2 minutes to open the browser and navigate back to my site. – PrimeTimeTran Dec 19 '17 at 13:25
19

Depending on the browser they are handled differently, but typically I find that going to the default page of the site, and doing a hard refresh. CTRL + F5 (or ⌘ Command + SHIFT + F5 on macOS), will typically get it to update.

Anonymous
  • 738
  • 4
  • 14
  • 36
Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173
17

Well, overhead is overhead, but yes, not too big.

Also, browsers are sometimes "greedy" about cached files. You could clear cache and/or restart your browser and may see the change. If that fails though...

My cheapo solution is to:

  1. Visit your file at http://example.com/favicon.ico in your browser.
  2. Delete the favicon.ico from your webroot.
  3. Visit http://example.com/favicon.ico again in a browser, verify it's missing.
  4. Upload new one to your webroot.
  5. Visit http://example.com/favicon.ico again in a browser, verify it's the new one.

If that sequence doesn't work, then something else is going on.

artlung
  • 33,305
  • 16
  • 69
  • 121
17

ON MAC: + Shift-R or hold down Ctrl and click the reload button in the browser.

Mwiza
  • 7,780
  • 3
  • 46
  • 42
badmadrad
  • 2,513
  • 1
  • 12
  • 8
10

For Internet Explorer, there is another solution:

  1. Open internet explorer.
  2. Click menu > tools > internet options.
  3. Click general > temporary internet files > "settings" button.
  4. Click "view files" button.
  5. Find your old favicon.ico file and delete it.
  6. Restart browser(internet explorer).
nickhar
  • 19,981
  • 12
  • 60
  • 73
nam
  • 387
  • 4
  • 7
10

More than likely a web browser issue. 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.

Your web browser will not go out to the internet to check for a new favicon on its own... thank goodness.

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
Senica Gonzalez
  • 7,996
  • 16
  • 66
  • 108
  • 4
    "Your web browser will not go out to the internet to check for a new favicon on it's own...thank goodness." Why not? Why not refresh it eveyr time a page loads? It's a 2k image, which is peanuts. It should never be out of date. The whole caching idea is just silly in the grand scheme of things. – Simon Feb 05 '10 at 17:35
  • 5
    http://developer.yahoo.com/performance/rules.html mentions issues related to downloading favicon.ico that you may not have thought of. Good tips there all around. Caching is a valuable tool for making sure your site runs as fast as is practical. Caching is also useful for making your browser feel as fast as possible. – artlung Feb 05 '10 at 17:57
  • 7
    @Simon, caching is silly?!? I hope for your clients sakes that you've learned the importance of better web development since 2010. What's "silly" is NOT caching and making unnecessary requests to your server for what amounts to be a static file that rarely, if ever, changes. – Ed DeGagne Mar 08 '13 at 14:46
9

Try Opening In a New Tab

I tried many of the things above (resetting cache, refreshing, using the link tag, etc), I even checked my .htaccess file and reset the ExpiresByType variable.

But this is what finally worked for me in both Chrome (25.0.x) and Safari (6.0.1):

  1. Flushing cache
  2. Hard-linking the favicon with the <link> tag
  3. Navigating to mysite.com/favicon.ico
  4. Opening mysite.com in a new tab

(Up until step 3, refreshing in the same tab kept reproducing the old icon.)

Old McStopher
  • 6,295
  • 10
  • 60
  • 89
8

For Chrome on macOS, if you don't want to delete the entire Chrome favicon database as suggested already here, you can delete only the conflicting icons:

  1. Quit Chrome
  2. Load the favicons database (using sqlite here):

sqlite3 ~/Library/Application\ Support/Google/Chrome/Default/Favicons

  1. Search for the file that is causing issues

select * from favicons where url = 'http://mysite.dev/favicon.ico';

  1. If you are happy with the output:

delete from favicons where url = 'http://mysite.dev/favicon.ico';


Alternatively, you can search for a pattern that you can reuse to delete multiple entries:


  1. Search for multiple files that are causing issues

select * from favicons where url like 'http://mysite.dev%';

  1. And again if you are happy with what this returns:

delete from favicons where url like 'http://mysite.dev%';


  1. Type .exit and hit return to quit sqlite
  2. Restart Chrome
MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
8

Chrome Version: 68.0.3440.106

Just restart Chrome (in your address bar): chrome://restart

Pascal
  • 1,158
  • 17
  • 20
7

When you request the favicon from Google, you can take a look at the response headers.

Last-Modified: Fri, 09 Jan 2009 16:35:02 GMT
Date: Thu, 01 Dec 2010 00:00:01 GMT
Expires: Fri, 01 Dec 2011 00:00:01 GMT
Cache-Control: public, max-age=31536000
Age: 7

If you put an "Expires: " header on the response, client browsers will re-request the icon after that timestamp. While doing active development, you could set the expires timestamp to a second or two in the future, and always have it fetch this, although that's a poor longterm plan.

Dean J
  • 39,360
  • 16
  • 67
  • 93
7

Chrome's favicon support is buggy - disregard this answer

I wrote this answer under the impression that this is what it took to refresh favicons in Google Chrome. However, it turns out that this only works for the first five minutes or so, until the icon gets irretrievably lost in Chrome's history synchronization.

Original answer

You don't have to clear your cache, restart your browser, or rewrite your HTML - you just need to change the icon's URL, once, so that the browser will forget the previously-cached icon.

Assuming that you've defined your icon via <link> elements in your page's <head>, you can do that by running this standard-JS one-liner in the console:

[].slice.call(document.querySelectorAll('head>link[rel$="icon"]')).map(function(ln){ln.href+='?v=2'});

For a more advanced implementation of this that can automatically do this for end users in production, see freshicon.js.

Stuart P. Bentley
  • 10,195
  • 10
  • 55
  • 84
  • This is actually useful if you're trying to get rid of an cached icon on a server you don't control, where the icon is now missing/returning a non-200 http code. Rather than appending `?v=2` swap out the whole URL for an icon of your choice and it seems to stick around after a refresh – Paul S. Jul 20 '17 at 21:12
4

If you are using PHP .. then you can also use this line.

<link rel="shortcut icon" href="http://www.yoursite.com/favicon.ico?v=<?php echo time() ?>" />

It will refresh your favicon on each page load.

Shakeel Ahmed
  • 1,526
  • 17
  • 22
4

I recently restored my bookmarks and was looking for a way to restore the FavIcons without visiting each page. My search brought me to this thread.

For those in a similar circumstance merely download the FAVICON RELOADER addon. Once installed you will find the "reload favorite icons" command in your BOOKMARKS dropdown menu.

https://addons.mozilla.org/en-US/firefox/addon/faviconreloader/?src=api

John Conde
  • 217,595
  • 99
  • 455
  • 496
bgc
  • 49
  • 1
  • It is back there for installation and really lookes promising (you'll find the AddOn within the bookmarks menu) but it also didn't reload the icon on my firefox 34 (on linux) without restart – rubo77 Dec 11 '14 at 08:19
3

If you are just interested in debugging it to make sure it has changed, you can just add a dummy entry to your /etc/hosts file and hit the new URL. That favicon wouldnt be cached already and you can make sure you new one is working.

Short of changing the name of the favicon, there is no way you can force your users to get a new copy

cpjolicoeur
  • 12,766
  • 7
  • 48
  • 59
2

This is a workaround for the chrome bug: change the rel attribute to stylesheet! Keep the original link though. Works like a charm:

I came up with this workaround because we also have a requirement to be able to update customer's sites / production code and I didn't find any of the other solutions to work.

2

This works for Chrome:

  • on Mac: delete file

    ${user.home}/Library/Application Support/Google/Chrome/Default/Favicons

  • on Windows: delete files

    C:\Users[username]\AppData\Local\Google\Chrome\User Data\Default\Favicons C:\Users[username]\AppData\Local\Google\Chrome\User Data\Default\Favicons-journal

source

Nikolai Koudelia
  • 2,494
  • 1
  • 26
  • 28
1

Simple,

1: I don't want to fiddle around with codes (ps my site builder doesn't use codes, it uses "upload file" button and it does it itself)

2: I tried the CTRL+F5 and it doesn't work for me so....

I HAVE A SOLUTION:

IE: Clear All browser history and cookies by going to the settings cog O

Chrome: Go to the menu in the top right corner below the X that looks like a = , then go to settings, history, CLEAR BROWSING DATA and check all of the boxes that apply (I did history, cookies and empty the catche from the beginning of time)

Mwiza
  • 7,780
  • 3
  • 46
  • 42
Robert
  • 41
  • 1
  • 4
    the question relates to how favicons are cached. Clearing your local cache is going to fix the problem for you but not for anyone else. – Mark Chorley May 30 '13 at 18:51
  • @MarkChorley which is exactly what the original question is about. Caching of favicons on a local development environment. – MrUpsidown Feb 20 '17 at 10:35
1

I know this is a really old question but it is also one that is still relevant, though these days applies only to mozilla. (I have no idea what explorer does coz we don't code for non standard browsers).

Chrome is well behaved if one includes an icon tag in the header.

Although mozilla are well aware of the issue, as usual, they never fix the annoying small stuff. Even 6 years later.

So, there are two ways of forcing an icon refresh with firefox.

  1. Have all your clients uninstall firefox. Then re-install.

  2. Manually type just the domain in the url bar - do not use http or www just the domain (mydomain.com).

This assumes of course that your ns records include resolution for the domain name only.

rockmo
  • 538
  • 4
  • 9
1

Just change this filename='favicon1.ico'

Armin Alibasic
  • 261
  • 4
  • 9
1

Close all Google Chrome windows

Adding one more answer that I do not see here. I tried flushing my Google Chrome cache, reloading the tab, refreshing the tab, opening in a new tab, and even opening a new window. Nothing worked for me. What did finally work for me was to close all Google Chrome windows (if you're like me, you probably have 3+ windows with a bunch of tabs, and maybe even have more windows/tabs in another desktop, don't forget those!). Once all of your windows are closed, then try opening a fresh new window and reloading your site.

Hope this helps someone!

Bonus tip: If you'd like to get all your windows back, you can press "Ctrl + Shift + Up Arrow + T" to get your windows and tabs back.

tlochner95
  • 127
  • 3
  • 15
0

Also make sure you put the full image URL not just its relative path:

http://www.example.com/images/favicon.ico

And not:

images/favicon.ico
ssc-hrep3
  • 15,024
  • 7
  • 48
  • 87
Amr Elgarhy
  • 66,568
  • 69
  • 184
  • 301
  • 4
    `/images/favicon.ico` is the proper way to do it: it "just works" for different environments (dev/test/production), and is an absolute path - from the document base URL. – ANeves Apr 24 '12 at 10:37
  • Unfortunately you need the fully-qualified URL for IE7 (&IE8?) - see http://jeffcode.blogspot.com.au/2007/12/why-doesnt-favicon-for-my-site-appear.html – eug Apr 24 '13 at 11:10
  • 3
    This isn't really an answer, this is a comment. – Zac Feb 04 '16 at 18:16
0

If the problem continues despite of applying some steps above:

try to restart the IIS Server.

Murat Yıldız
  • 11,299
  • 6
  • 63
  • 63
0

Here's how I managed it with a simply animated favicon and FireFox 3.6.13 (beta version) It will probably work for other versions of FireFox as well, let me know if it doesn't. It's basically artlung's solution, but addressing the .gif file as well:

  1. I opened by FTP program, downloaded my favicon.ico AND favicon.gif files,
  2. then DELETED them from my server's files.
  3. Then I opened them in my browser as artlung suggested: http://mysite.com/favicon.ico AND http://mysite.com/favicon.gif Once those addresses loaded and displayed 404 error pages ("page not found")
  4. I THEN uploaded both files back onto my server, and PRESTO - the correct icons were instantly displayed.
  • 1
    Oh - BTW to get the new ones to display I also had to delete my saved bookmark - and this same procedure worked for Google Chrome as well. – lineofbirds Feb 10 '11 at 01:02
0

Use query string at the end of the file path. Query string variable value must be different with every build.

if previous build is:

<link rel="icon" href="http://example.com/favicon.ico?v=v1" />

OR

<link rel="icon" href="http://example.com/favicon.ico?v=stringA" />

then next build should be:

<link rel="icon" href="http://example.com/favicon.ico?v=v2" />

OR

<link rel="icon" href="http://example.com/favicon.ico?v=stringB" />

Billu
  • 2,733
  • 26
  • 47
0

Using "Empty Caches" from the "Develop" menu is the only thing that worked for me on Safari 17.

-3

Please follow below steps to change app icon:

  1. Add your .ico file in the project.
  2. Go to angular.json and in that "projects" -> "architect" -> "build" -> "options" -> "assets" and here make an entry for your icon file. Refer to the existing entry of favicon.ico to know how to do it.
  3. Go to index.html and update the path of the icon file. For example,

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

Alternatively, rename your icon file with favicon.ico and replace it in the directory.

  1. Restart the server.
  2. Hard refresh browser and you are good to go.
Rut Shah
  • 1,093
  • 11
  • 13
-3

Simon, I suppose there's a reason none of the other answers is accepted so far. Thus I believe this could be a Grails issue nevertheless - Especially if you're using the 'Resources Plugin'.

If your plugins provide a favicon (which - illogically - many do), they might override the one you desired to use - given yours is in a plugin itself.

If deleting the favicon from all your plugins temporary resolves the issue then you're very likely experiencing this:

http://jira.grails.org/browse/GPRESOURCES-134

user569825
  • 2,369
  • 1
  • 25
  • 45
-5

It may be useful to just a few people, but I had the same problem and discovered that it was related to file permessions, so I gave it a 777 permission and it worked, of course after you're sure the problem it's there, make sure to change back the permissions to safer values.

jack_the_beast
  • 1,838
  • 4
  • 34
  • 67