Search code examples
delphidelphi-xe2chromiumfaviconchromium-embedded

Chromium Embedded Framework favicon


How to get favicon website with Chromium Embedded Framework? I could look at the source code and get the url of the icon, but some sites, like Facebook, do not use a standard procedure to add a favicon, then, how do I get the favicon? Thanks.


Solution

  • The rules for the favicon are all explained on the Wikipedia page.

    The standards use a link element with a rel attribute in the <head> section of the document to specify the file format, file name and a location can be specified for any Web site directory.

    You need to look, inside the <head> element, for link elements of this form:

    <link rel="shortcut icon" href="http://example.com/myicon.ico" />
    

    or

    <link rel="icon" type="image/vnd.microsoft.icon"
        href="http://example.com/image.ico" />
    

    If you don't find such links, then use the fall back of looking for favicon.ico at the root directory.


    I'm not certain why you think that Facebook don't follow the standard. I just looked at an FB page which contained this:

    <link rel="shortcut icon" 
        href="http://static.ak.fbcdn.net/rsrc.php/yP/r/Ivn-CVe5TGK.ico" />
    

    It's not possible for websites to use some other mechanism to get favicons to browsers. The browsers follow the well-defined rules for getting favicons. If a website did something different, the browser would not find the favicon.