tags:

views:

1036

answers:

6

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't see it in any browser. The old favicon shows up or I get no favicon at all, but not my new one. I don't think this is a Grails issue per se, more an issue wth 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 cacheing them? It seems pretty silly to always cache them given they are normally only 16x16. Why not just upload every visit to the page, it's not exactly a huge overhead.

A: 

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 dont' believe your favicons will get refreshed on your favorites until you revist 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 it's own...thank goodness.

Senica Gonzalez
"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
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
+1  A: 

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, will typically get it to update.

Mitchel Sellers
+2  A: 

Rename the favicon file and add an html header with the new name, such as:

<link rel="SHORTCUT ICON" href="http://www.yoursite.com/favicon2.ico" />
klausbyskov
what does this do?
Simon
+1  A: 

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
A: 

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
A: 

Also make sure you put the full image url not just its relative path:
http://www.example.com/images/favicon.ico
Not
images/favicon.ico

Amr ElGarhy