views:

309

answers:

5

I was looking around the web at the way different sites put their favicon into the site. Whenever I try to do it myself I end up "hacking" until it just suddenly decides to work.

I suppose I have 2 questions in one here.

  1. How is this site adding it's favicon? - http://www.fbd.ie

    I can't find favicon.ico in it's page source.

  2. Apart from including <link rel="shortcut icon" href="/favicon.ico">, how can I include a favicon?

+10  A: 

The easiest way to add a favicon is to simply put a file named favicon.ico into the root directory of your web site.

Browsers will find it automatically.

You can also specifically put in a <link> tag. Any of these will work:

<link rel="icon" type="image/vnd.microsoft.icon" href="http://example.com/image.ico"&gt;
<link rel="icon" type="image/png" href="http://example.com/image.png"&gt;
<link rel="icon" type="image/gif" href="http://example.com/image.gif"&gt;

Edit: I see you knew that already. :D

zombat
+1  A: 
  1. It probably just has a file called favicon.ico in the root directory of the website. Most browsers will just look there by default regardless of if there is a <link> tag or not.
  2. See answer to #1.
Sean Bright
http://www.fbd.ie/favicon.ico
Swingley
A: 
  1. There is a lot of JS files, so i think maybe JS inlcude it onload :)
  2. <link rel="shortcut icon" href="/favicon.ico">
Rin
?????????????????????????
dfa
@1: Of course the easiest way is best way, so do it via link tag :)
Rin
@dfa: A lot of Js files includes on page what author give us at start: http://www.fbd.ie/
Rin
Most certainly is not being done in the JS.
Sean Bright
A: 

If found the icon at:

http://www.fbd.ie/favicon.ico

It is tiny and greed and says FBD.

MatthewMartin
A: 

All you have to do is include the file in the root of your site. Browsers are designed to request this automatically - you will see a large number of requests for it 404ing in your web logs if you don't have one!.

From wikipedia:

The original means of defining a favicon, introduced in Internet Explorer 4, was by placing a file called favicon.ico in the root directory of a web server. This would then automatically be used in Internet Explorer's favorites (bookmarks) display. Later, however, a more flexible system was created using HTML to indicate the location of an icon for any given page. As detailed below, this is achieved by adding a link element to the section of the document which specifies the type of the image file and its location. In this way any image file defined by the standard may be used.

The salient point is that you don't have to do anything in your HTML mark-up or any other resource file. Just dump the file in the root.

annakata