androidiconsshortcut-file

How to define the website screen shortcut icon?


I can't find how to make Android use a custom icon (e.g. the favicon or the app-touch image that iOS uses) for a website shortcut.

Can you give me a hint?


Solution

  • Android uses a home screen image AND a "Shortcut icon" (like favicon). If you only specify the home screen icon, the web page will not display an icon next to the URL in the web browser.

    The "shortcut icon" must be listed separately, even though it can be the same file.

    <link rel="shortcut icon" href="http://yourdomain.com/path/icon57.png" />
    <link rel="apple-touch-icon" href="http://yourdomain.com/path/icon57.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="http://yourdomain.com/path/icon72.png" />
    <link rel="apple-touch-icon" sizes="114x114" href="http://yourdomain.com/path/icon114.png" />
    <link rel="apple-touch-icon" sizes="144x144" href="http://yourdomain.com/path/icon144.png" />
    

    Relative URLs will work for many devices, but most sources say you need to use absolute URLs.

    Listing the sizes separately allows the device to download only the smallest image that meets it's needs. For the "shortcut icon", you can't list different sizes, but you can use an ICO file which may contain multiple sizes encoded in the file. Many image programs like GIMP can save ICO files with multiple sizes.

    Note that if you want the shortcut icon to display in IE, it must be a real ico file.

    Apparently, Android versions 2.1 and earlier only recognize the "precomposed" image link, but if you include the precomposed icon, every device that is capable of "fancifying" icons will skip their process and just use the precomposed ones. The Androids I tested can do their own fancifying, so I don't use precomposed icon links. It will depend on your compatibility needs.

    <link rel="apple-touch-icon-precomposed" href="http://yourdomain.com/custom_icon.png"/>
    

    For more information about using home screen icons...

    http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html