#/> convert favicon.png favicon.ico
Seriously, that's it. The convert command is amazing. There are many other options for this command, so be sure to check the man-page. If you don't have convert installed on your Linux box, chances are all you need is the ImageMagick package (yum install ImageMagick on CentOS and Fedora).
Step two, once I had the favicon.ico file I placed it at the root of my site (http://mark.koli.ch/favicon.ico). I then added the following <link> tags to the <head> of each HTML document:
<link rel="icon" href="http://mark.koli.ch/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://mark.koli.ch/favicon.ico" type="image/x-icon" />
This method seemed to work fine for Firefox/Mozilla, but (of course) I couldn't get the icon to load in IE7. So, I dug into how google.com handles it, and it appears that they use a small bit of JavaScript to create a new Image object which essentially preloads their favicon file. Based on that model, here's what I'm using:
(new Image).src="http://mark.koli.ch/favicon.ico";
I've placed this in the $(document).ready function of my jQuery code, so the favicon image is preloaded when the DOM is loaded. After all this, it appears my favicon finally loads correctly each time in Firefox and IE7.


Did you find this post helpful, or at least, interesting?