Question

What is the best way to link to the icons of websites? Meaning, given a hostname, what src should I put in an <img> tag to link to the 16x16 icon?

I was just doing http://<hostname>/favicon.ico. It seems some .ico files aren't liked by different browsers. Chrome seems to like them all, but Safari, FF and IE all have problems with various icons.

Example page: http://paultarjan.com

Was it helpful?

Solution

Think the problem is just that those browsers don't support the .ico file format in img tags. You probably need to make a proxy for it that converts to png or something. Though, testing that just now, Safari seems to load that example one just fine. One strange thing about that one though: it's 32x32.

Also, though almost everyone does use /favicon.ico, you can actually use anything and define it in a <link> tag in the head of your pages. I don't how much this matters for what you're doing, but technically you can't rely on it being called that.

If this doesn't help then please specify how the .ico files "aren't liked" by different browsers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top