开发者

Cannot get Favicon.ico to display

I have copied my favicon.ico file to my Apache document root. I had to add an Apache Rewrite exception for it and now it is accessible from www.example.com/favicon.ico. But when I hit my main URL it does not show up.

I thought all you had to do was copy the file with the correct permissions into the doc root? Do I need to make php changes? 开发者_StackOverflow社区 Thanks!


Try throwing this tag in the head of your document:

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


IE and Firefox can behave differently (not sure which one you are using). Try to add the page as a bookmark, then click the bookmark (to load the page). After you do that exit your browser and see if the if shows up then.

If that does not work try to clear your browser cache and repeat the above steps that should fix it. I have seen your problem before!


the favicon.ico reference must be an absolute URL, not relative. Using this:

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

My status was

favicon.ico () shows up in:

    IE 9.0.8
    Safari 5.1.7 

Fails in:

    FF 28.0
    Google Chrome 34.0

changing to absolute values

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

causes all browsers to locate and display the favicon.ico


Could it be that you uploaded the favicon after your browser has remembered that your domain doesn't have one and therefore doesn't issue a new request?


favicon icon behaves differently for different browswrs & sometimes if it works in FF & does not work in IE. Try after Clearing the cache of the browser and standard code for favicon ico is, Just put below tag in your index file OR whichever common file for your project.

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

Although new browsers support GIF and PNG images , but , I would suggest always saving the image as favicon.ico.


Try placing the ico file in an images folder in your root. That's where many browsers look for favicon. And that's something to keep in mind. Favicon is a very loose standard, if you can even call it that, which is supported by browsers, not by the server. The browsers themselves actually fetch favicons in separate calls to display on their favorites bars, or tabs... The favicon file just has to be placed somewhere that the browsers can find it.


Some browsers will pick up the icon if its in the root directory without adding anything to the page, however IE and FF don't. Add this code to the head section of your page

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


It seems like in Chrome that you cannot use a link (ex. https://) rather must you have the favicon.ico in the same folder as the index.html. For any other file, it seems to work with a link.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜