Fortunately, there is a "hidden" Google API of sorts that handles this for you. It is used to pull in favicons for websites attached to your Google+ profile page. It works as follows:
It turns out the fallback can be one of a few things. So far, I've discovered that setting the 'alt' parameter to 's' yields a blank page icon and 'p' yields a page template icon when no favicon is available. Setting to any other single letter yields a browser/world icon. There could be more, but I have only checked for single letters so far.