5

My favicon isn't working properly. It is located in the root of my project. Do I need the absolute path to my icon?

e.g.: "C:/Users/Damian/www/favicon.ico" Or should I type instead:

<LINK REL="SHORTCUT ICON" HREF="favicon.ico" >   

Is that enough? I have cleared my browser's cookies.

Cœur
  • 37,241
  • 25
  • 195
  • 267
DRastislav
  • 1,892
  • 3
  • 26
  • 40
  • How are you serving the HTML page? – Matt Ball Dec 25 '12 at 22:08
  • 4
    The favicon of a page gets cached very aggressivly. clearing your browser cookies has no effect in it. clearing the browser cache would be the correct way. testing it in the private mode of your browser is the easiest way. – remy Dec 25 '12 at 22:10
  • 4
    Also try to access your favicon directly (by typing it in the addressbar) and hard refreshing the page. This has worked for me on most occasions. BTW cookies has nothing to do with your favicon. – PeeHaa Dec 25 '12 at 22:10
  • Possible duplicate of [How to add a browser tab icon (favicon) for a website?](http://stackoverflow.com/questions/4888377/how-to-add-a-browser-tab-icon-favicon-for-a-website) – Michał Perłakowski Apr 08 '16 at 01:32

3 Answers3

5

Relative paths are fine, as long as the path is relative to the document you are serving.

Have a look at the below link- it may help.

http://www.w3.org/2005/10/howto-favicon

What browser are you using? Keep in mind that it is up to the browser to display the icon, and different browsers may have different ways of how the expect the icon to be shown in the HTML. If you are sure your HTML is correct, it may pay to try a different browser.

Lock
  • 5,422
  • 14
  • 66
  • 113
5

If your favicon is in the same directory as the page:

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

Otherwise use this

<link rel="icon" href="your_url/favicon.ico" type="image/x-icon" />
Daniel Kurz
  • 816
  • 7
  • 21
1

The favicon needs only the relative path. It is working fine, but it is a matter of browser's cache. Try to clear your history and cache then try again. Or if you use localhost to access your website, try to use 127.0.0.1

SaidbakR
  • 13,303
  • 20
  • 101
  • 195