Why isn't my favicon working? [closed]

妖精的绣舞 提交于 2019-12-25 00:16:35

问题


Now I know there are a lot of similar questions around SO but I think I've covered all the basics. Here's what I know:

My favicon is accessible through /favicon.ico (full link)

The HTML is (page URL):

<link rel="icon" href="http://www.bandcmotors.co.uk/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://www.bandcmotors.co.uk/favicon.ico" type="image/x-icon" />

I've tried relative and absolute versions too. No love.

The HTTP response headers:

Date: Mon, 22 Dec 2008 15:07:34 GMT
Server: Cherokee
Etag: 494bc264=57e
Last-Modified: Fri, 19 Dec 2008 15:48:52 GMT
Content-Type: image/x-icon
Content-Length: 1406

200 OK

The icon loads fine in a browser and I've cleared my cache but I still can't see the icon in the address bar or tab. On either Firefox or IE.

What on earth am I doing wrong?

Edit 1. I used a validator and it rather helpfully told me that it could not download it. Rather odd considering I can download it fine... If anybody could explain that, it might help fix the problem.

Edit 2. I just drop-kicked my computer, restarted and it all worked. I hate caches that refuse to clear themselves properly ****grumbles**** >=(


回答1:


Have you tried using a gif or png? The W3C documentation cites the following:

However, the format for the image you have chosen must be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit colors. The format of the image must be one of PNG (a W3C standard), GIF, or ICO

Does your image conform? Have you tried using other favicons?




回答2:


it works fine, your browser is probably caching it for some reason.

Btw., ETags are not recommended in such situations, better just use an "Expires: " header ...




回答3:


It works fine in my safari browser, even in windows... ;)




回答4:


Have you tried using the relative path to the icon, not the full "http://...." address? For example:

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

Another suggestion would be removing the type attribute:

<link rel="shortcut icon" href="/favicon.ico" />

I can see it in Firefox and Opera too, as is.




回答5:


It may be an issue with your hosting provider (if applicable). GoDaddy & other popular hosting providers cache certain details & refresh your "virtual server" about once per hour.



来源:https://stackoverflow.com/questions/386828/why-isnt-my-favicon-working

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