[webkit-help] Getting favicons from icon database

Christiaan Hofman cmhofman at gmail.com
Wed Nov 3 12:38:19 PDT 2010

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?


More information about the webkit-help mailing list