Html 为什么我的图标不显示?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4248343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why isn't my favicon showing up?
提问by William
Alright, so my favicon isn't showing up for some reason. It's at image/favicon.ico (I've checked like 5 times).
好的,所以我的收藏夹图标由于某种原因没有出现。它在 image/favicon.ico (我已经检查了 5 次)。
This is the code I use for it:
这是我用于它的代码:
<link rel="shortcut icon" href="images/favicon.ico" />
And this is the site: http://prime.programming-designs.com/
这是网站:http: //prime.programming-designs.com/
Edit: alright, I guess it's just my cashe.
编辑:好吧,我想这只是我的现金。
回答by Dave Kiss
It's probably just cached in your browser, it shows up as a blue cross on mine.
它可能只是缓存在您的浏览器中,它在我的浏览器中显示为蓝色十字。
Else, check your image path. image/favicon.ico
isn't matching images/favicon.ico
, but that is probably just a typo.
否则,请检查您的图像路径。image/favicon.ico
不匹配images/favicon.ico
,但这可能只是一个错字。
回答by Inga Johansson
Remove the cache of your browser and reboot the browser. Might take a while to show up in for example FF
删除浏览器的缓存并重新启动浏览器。可能需要一段时间才能出现在例如 FF
回答by mbunch
Late, however. I run into this problem more than I should. My fix is to add a 'version number' ?v1 or whatever, this will blow away cache.
不过晚了。我遇到这个问题的次数比我应该多。我的解决方法是添加一个“版本号”?v1 或其他什么,这会破坏缓存。
<link rel="icon" href="favicon.ico?v1" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico?v1" type="image/x-icon" />
回答by meder omuraliev
Most browsers like IE will request /favicon.ico
despite what you have set, but it should still work if you return the proper Content-Type and made it the right way.
大多数浏览器(如 IE)会根据/favicon.ico
您的设置进行请求,但如果您返回正确的 Content-Type 并以正确的方式进行设置,它仍然可以工作。
You can attempt to do:
你可以尝试这样做:
<link rel="shortcut icon" href="/images/favicon.ico?289349832" />
The query string usually forces the browser to re-request the resource since it's unique.
查询字符串通常会强制浏览器重新请求资源,因为它是唯一的。
You can also attempt to do a server redirect from /favicon.ico
to /images/favicon.ico
您还可以尝试将服务器重定向/favicon.ico
到/images/favicon.ico
You can also just move /images/favicon.ico
to the root.
您也可以移动/images/favicon.ico
到根目录。
However, browsers naturally really, really cache the crap out of favicons so my suggestion would be to wait, as most likely none of the above would help. In time it should show up on your browser.
然而,浏览器自然真的,真的从网站图标中缓存了废话,所以我的建议是等待,因为上面的方法很可能都没有帮助。它应该及时显示在您的浏览器上。
回答by Ates Goral
- Load up http://prime.programming-designs.com/images/favicon.icoin your browser to 100% verify that the path is correct.
- Check the
Content-Type
header returned by the server. Some browsers might be oversensitive. You may have to register the MIME type for the.ico
extension. - As others have said, try clearing the browser cache.
- 在浏览器中加载http://prime.programming-designs.com/images/favicon.ico以 100% 验证路径是否正确。
- 检查
Content-Type
服务器返回的标头。某些浏览器可能过于敏感。您可能必须为.ico
扩展注册 MIME 类型。 - 正如其他人所说,尝试清除浏览器缓存。
回答by William
I just renamed favicon to favicon1 and uploaded the changed files and it worked.
我刚刚将 favicon 重命名为 favicon1 并上传了更改后的文件并且它工作了。