Cannot get Favicon.ico to display

半世苍凉 提交于 2019-12-19 02:58:00

问题


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? Thanks!


回答1:


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!




回答2:


Try throwing this tag in the head of your document:

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



回答3:


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?




回答4:


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




回答5:


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.




回答6:


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.




回答7:


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



回答8:


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.



来源:https://stackoverflow.com/questions/2201406/cannot-get-favicon-ico-to-display

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!