Search
Web Braintrove
Site Navigation
Home
Products
Tags
Levels
Dates
Authors
5 MOST RECENT
Perform a Case-Insensitive String Comparison without Using Translate()
Force a Field Value to a Boolean Using Rules
Quickly Crop to a Shadow
Sum Repeating Time Values
Preview and Open Forms after Upgrading to Internet Explorer 8
5 MOST POPULAR
Pass Query String Parameters to an ASP.NET Xml Control
Access a Method in a Master Page with Code-Behind
Prevent Namespace Prefixes from Being Copied to the Output
Create Groups in a Drop-Down List Box
Change the Default Action of the Power Button on the Windows Vista Start Menu
5 MOST FORGOTTEN
Install Windows 7 Beta onto a Virtual Machine
Convert Between Time and Decimal
Configure Lab Color Mode Defaults for Braintrove Articles
Stop Outlook Sending Mail to Unintended Recipients
Add a Custom Icon to Your Web Site
Books
Teach Yourself VISUALLY HTML
HTML Utopia : Designing Without Tables Using CSS
HTML Utopia: Designing Without Tables Using CSS
Creating Cool Web Sites with HTML, XHTML, and CSS
Sams Teach Yourself HTML & XHTML in 24 Hours
Magazines
Soa Web Services Journal
Visual Basic & Net Journal
Inside Visual Basic
Practical Web Design
Visual Studio Magazine
Microsoft MVP
This article has been viewed 189 times.

Add a Custom Icon to Your Web Site

Written by Gregory Scot Collins
Monday, 26 February 2007, 5:34 PM
This article has been tested to work with the following products and versions. No guarantee of compatibility, with or without modification, is offered for products or versions other than those listed.
Perhaps you've been impressed by Web sites that have their logo appear in the browser next to the page title and want to do the same thing for your own site. It's actually quite simple to do. This custom icon is known as a "favicon" (a concatenation of the words favorites and icon), the name originating from Microsoft Internet Explorer displaying these icons in the list of favorites.
Modern browsers automatically look for a file named favicon.ico located in the root folder of a Web site. If the file exists, the browser will display the icon next to the page title in the address bar, tab, and favorites/bookmarks listing, as shown in Screenshot 1. Some older browsers have the capability to display the icon, but need to be notified that there is one and where it is located. This can be done by adding specific link tags to the head section of your web pages, as shown in Listing 1:
While use of the link tags is optional, it is best practice to use these link tags instead of relying on the automatic favicon detection features of a browser. Both link tags should be used in order to support multiple browsers, including older browsers are capable of displaying the favicon. Each page that should display the icon should contain these tags. When present, modern browsers will use the link tags instead of auto detecting whether the favicon.ico file is present.

Create your custom favicon

Favicons typically depict a company logo, or another identifiable associated trademark or some subset thereof. If you do not have your own icon, you can download or purchase icon editing software to create one. Or, instead of an .ico file, you can also use a .png (type="/image/png") or .gif (type="/image/gif") file. Some browsers even support animated .gif files. These alternate image formats have the advantage of not requiring any specialized software for creating icon files. However, they have the disadvantage of not being able to support multiple image sizes. Whichever format you choose, your image should be sized at 16x16 pixels or 32x32 pixels. If you choose to use an .ico file, your favicon file can contain multiple images of varying size and color depth, as shown in Screenshot 2.

Handle multiple Web sites on a single shared hosting service

Using the link tags, you can specify the name and location of your favicon file. When hosting multiple Web sites on a single shared hosting service, this is important so that each site can have its own icon. Otherwise, all sites would be left to use the same icon. For example, Listing 3 shows the tags as one site might specify them:
While Listing 1 shows the tags as a second site might specify them:
Bookmark this Article
StumbleUpon  Stumble It!
Digg  Digg It!
del.icio.us  del.icio.us
List of Figures
Listing 1 - Instructing the browser to use the favicon.ico file located in the root folder.
Screenshot 1 - The Braintrove favicon as see in Internet Explorer 7.
Screenshot 2 - The Braintrove favicon.ico file contains images sized from 16x16 pixels to 64x64 pixels.
Listing 2 - Instructing the browser to use the Site1.png file located in the Path1 folder.
Listing 3 - Instructing the browser to use the Site2.ico file located in the Path2 folder.
Article Tags
Great Deals
TigerDirect Exclusive Deals, Limited Time Offers, Act Now And Save!
Find all current special offers on Adobe products.
Try SugarSync Free!
Join WebHost4Life.com
TigerDirect
Computers4SURE (4SURE.com - An Office Depot Co.)
Copyright © 2006-2010 Braintrove. All rights reserved. Braintrove, braintrove.com, and the Braintrove logo are trademarks of Gregory Scot Collins in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Any rights not expressly granted herein are reserved.