Some Site, when added to favorite, will show an icon here like github.com:

enter image description here

How do you set the icon here?

I've tried this code and it doesn't work:

<link rel="apple-touch-icon" sizes="57x57" href="../apple_touch_icon_57_57.png" />
<link rel="apple-touch-icon" sizes="114x114" href="../apple_touch_icon_114_114.png" />
<link rel="apple-touch-icon" sizes="72x72" href="../apple_touch_icon_72_72.png" />
<link rel="apple-touch-icon" sizes="144x144" href="../apple_touch_icon_144_144.png" />
<link rel="apple-touch-icon" sizes="60x60" href="../apple_touch_icon_60_60.png" />
<link rel="apple-touch-icon" sizes="120x120" href="../apple_touch_icon_120_120.png" />
<link rel="apple-touch-icon" sizes="152x152" href="../apple_touch_icon_152_152.png" />
<link rel="icon" type="image/png" sizes="16x16" href="../favicon_16_16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="../favicon_32_32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="../favicon_96_96.png" />
<link rel="icon" type="image/png" sizes="160x160" href="../favicon_160_160.png" />
<link rel="icon" type="image/png" sizes="192x192" href="../favicon_192_192.png" />

It looks like your url path for the actual icons are incorrect. Currently you are using ../ which means that your file is located up a level. I.e if you browsed http://example.com/home/ and assuming you had the icons in the root then it would work... but visiting just http://example.com would not work since ../ does not exist because you can't go any higher than the root.

The fix would be to copy all files into the root / and then use /example.jpg or if you would like the icons in a folder then use the absolute path i.e.

<link rel="apple-touch-icon" sizes="57x57" href="http://example.com/images/image.png" />

Let me know if this is the problem otherwise I'll remove this, since you haven't supplied us with the URL its guessing.

  • turned out that my path is wrong and safari has an icon cache,having worked on both problem and the icon appears. – CarmeloS May 9 '15 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.