Favicon
Use the code
<link rel="shortcut icon" href="/images/favicon.ico" type="images/x-icon" />to associate an image with your web page. There are several points worth noting
- There is no guarantee that the inclusion of this line will result in the image actually being used and displayed by the browser.
- While most browsers now accept other file formats, such as .PNG, the .ICO format continues to be the safest one.
- Some hosting services block the upload of .ICO files. However, it is easy to get around this problem - simply upload the file with another extension, e.g. .GIF, and then change it back to .ICO!
- Before IE7 the icon would not show up on the address bar unless the user added the site to his/her favorites.
- The terminating solidus, /, is only required with XHTML.
/images/here refers to the virtual directory where you store your image files. Given that some browsers have a habit of seeking out a favicon.ico file even in the absence of this line in the head section you may want to consider keeping this file in your root directory.- It is certainly possible to use different favicon files on different pages on your site. In that case you would replace
favicon.icowith other, more descriptive, file names. While there may be legitimate reasons for using multiple favicons, for the most part doing so is only liable to lead to confusion. - Keep your favicons simple - typically 16 x 16 pixels and no more than three colors.