Search code examples
xhtmliconsfavicon.ico

Can I get an .ico( Icon) to display from a local file


I am doing client side testing for my web application using IE only, there is no server - so I can test my CSS/XHTML/Javascript.

When I add the line

<link rel="icon" href="favicon1.ico"/>

or

<link rel="icon"href="favicon1.ico"type="image/x-icon"/>

or

<link rel="shortcut icon"href="favicon1.ico"type="image/x-icon"/>

I do not see my .ico image displayed in the tab.

My favicon1.ico is a 32px by 32px (32 bpp, 8-bit alpha, no pallete) .ico file created/saved in GIMP residing in the same directory as my html files.

Pretty convinced IE needs a server at this point.


Solution

  • Quote OP: <link rel="SHORTCUT ICON" href="d:/bi1.ico"/>


    You'd simply reference all external files with relative urls.

    If your icon file is contained in the same directory as your page...

    href="MyIcon.ico"
    

    EDIT:

    This was a perfectly valid answer to the original posting. However, the original posting has since been edited to the point where the above answer no longer makes sense.

    EDIT 2:

    The following is how mine is working.

    I believe that some browsers are fussy about the name so I use favicon.ico.

    <link href="favicon.ico" type="image/x-icon" rel="shortcut icon" />
    

    EDIT 3:

    Quote OP: "I just saved a 40px by 40px as a .ico file"

    This does not sound right at all. ICO files used for the Favicon are typically 16 x 16 pixels with an optional 32 x 32 pixel desktop version and/or an optional 48 x 48 pixel XP version.

    Here is an online tool for creating a proper favicon.