[webkit-help] Getting favicons from icon database

Dan Wood dw43031apple at karelia.com
Tue Nov 23 14:44:01 PST 2010

Did anybody have any luck with this?  My application (iMedia framework) is having similar, though distinct, problems.  We're not loading any URLs so for me, all the images we are getting are generic globes.  We call [WebIconDatabase sharedIconDatabase] (from the main thread) early on, which should cause the database to be started up.  I've verified that the database is enabled by checking the boolean property and also by confirming that file:// URLs in the bookmarks are showing their file icons.  According to the implementation of iconForURL:withSize:cache: this can only happen if the database is enabled.

What is Safari doing to get the specific favicon images that we're not doing?  Any third-party applications that have figured this out?

On Nov 3, 2010, at 12:38 PM, Christiaan Hofman wrote:

> I am using the Mac port of WebKit from a Cocoa app on Snow Leopard. I have problems getting the favicons from the database, which does not seem to work properly.
> My main problem is that the persistent icon database does not seem to be loaded. I only get non-default icons (i.e. different from the standard blue globe) for URLs that have been loaded during the current launch session of the app, while for URLs visited in previous runs I consistently get the default icon. I have confirmed that the icon database is enabled and started up (the WebIconDatabaseEnabled pref is true, and also -[WebIconDatabase _startUpIconDatabase] is called). I have also confirmed that my app does in fact update the database file ~/Library/Icons/WebpageIcons.db, and includes URLs that I have visited. I access icons for history items currently through -[WebHistoryItem icon], which seems to get them directly from [WebIconDatabase iconForURL:withSize:].
> Another problem is that I cannot find any generic API to get favicons for URLs, as WebIconDatabase.h is not included in the public headers. Is there a reason why this is private? And is there any other way to get the favicons, e.g. for bookmarks, or do I need to use private interface to access the database? Are there any plans to make it public?
> As several WebKit based browsers like Safari are able to successfully use the favicons (persistently and for bookmarks), I would expect that there should be workarounds for these problems (bugs). Could anyone tell me about these?
> Thanks,
> Christiaan
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-help

Dan Wood
Karelia Software — Sandvox for the Mac : http://www.karelia.com/
Follow me on Twitter: http://twitter.com/danwood http://twitter.com/karelia

One of the saddest lessons of history is this: If we've been bamboozled long enough, we tend to reject any evidence of the bamboozle. We're no longer interested in finding out the truth. The bamboozle has captured us. it is simply too painful to acknowledge -- even to ourselves -- that we've been so credulous — Carl Sagan

More information about the webkit-help mailing list