DRastislav
DRastislav

Reputation: 1882

favicon doesn't work

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.

Upvotes: 5

Views: 662

Answers (3)

SaidbakR
SaidbakR

Reputation: 13534

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

Upvotes: 1

Daniel Kurz
Daniel Kurz

Reputation: 816

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" />

Upvotes: 5

Lock
Lock

Reputation: 5522

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.

Upvotes: 5

Related Questions