Favicon not showing up in Firefox or Chrome

↘锁芯ラ 提交于 2019-12-11 12:08:44

问题


I've uploaded a favicon.ico to my client's root (htdocs) directory on the server and added the following before the </head> tag:

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

It loads fine in every browser EXCEPT for Firefox and Chrome. In those two, although the icon loads in the tab, it does not load in the web address bar. In Firefox I see a globe icon and in Chrome I see a document icon.


回答1:


Isn't this normal in Chrome and FF? I don't see the favicon in the address bar on any side in chrome. There the are displayed in the tab. The doc icon is use to show detailed information about the page. If you find a page showing a favicon in the address bar you can look at the page source to find out how they did it.




回答2:


As far as I know there are no favicons shown any more in Firefox since some sites used a "lock" symbol as favicon such mocking a secure connection (the secure connection logo would appear next to the favicon on the left of the URL). The favicons will still be shown in tabs and bookmarks though.




回答3:


Your code is fine (unless there's no such file for the favicon). You just need to clear your browser's cache or reload the page with purged cache (Ctrl+F5). However, you should know that it takes a while for FF/Chrome to recognize new favicons, so instead you can test them in other computers/browsers from which you haven't visited your site yet.




回答4:


I am not a real programmer and I had a similar problem and here is the simple thing that finally worked for me...

I admin several simple websites but Firefox refused to load the favicon of one in particular site. I looked online, tried everything I was able to understand. Nothing worked. The code was exactly the same (copied in fact) from the other websites whose icons worked well.

Eventually it dawned on me that maybe Firefox did not like the path I used to get there. This site was a forwarded URL being hosted on my own domain. (i.e. personal domain is myplace.ca and the favicon that would not load was part of registered URL something.com which was actually located at myplace.ca/PutItHere/) If I used the registered URL (something.com) no favicon. If I use the real path in the browser, suddenly favicon! All I had to do was bookmark the absolute path rather than the registered domain!




回答5:


...href="favicon.ico"/>"

Please note the "favicon.ico" in above line and avoid your prepended forward slash if it is in the root folder. It works fine for Firefox 24.0



来源:https://stackoverflow.com/questions/12820492/favicon-not-showing-up-in-firefox-or-chrome

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