Favicon 404 错误,即使 rel='icon'已设置
我的网站的一些访问者遇到了这个间歇性错误,即使我已经指定了这种格式的 favicon:
<link type="image/png" href="icon.png" rel="icon" />
有些用户仍然收到 favicon.ico 的 404 错误,就好像某些浏览器默认正在查找该文件名一样。我在追踪这种情况是如何发生时遇到了很多麻烦,因为我从未使用过名为 favicon.ico 的任何东西。有人有主意吗?谢谢。
I am getting this intermittent error for some visitors to my site where even though I've specified a favicon in this format:
<link type="image/png" href="icon.png" rel="icon" />
Some users are still getting a 404 error for favicon.ico as if some browser by default is looking for that filename. I'm having a lot of trouble tracking down how this could be happening as I've never used anything called favicon.ico. Anyone have an idea? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在根目录中放置一个“.ico”文件,并将其命名为 favicon.ico,以便所有浏览器都能识别最喜欢的图标。
Put an a ".ico" file in the root directory and name it favicon.ico so that all browsers will understand the favourite icon.
我认为 IE6 不支持 PNG 图像作为 favicon,因此它可能会尝试下载 favicon.ico。此外,关于 favicon 的维基百科文章表明存在更多与 IE 相关的问题。请参阅浏览器实现表。
I think IE6 doesn't support PNG images as favicons, so it's possible it's trying to download favicon.ico instead. Also, the Wikipedia article on favicons suggests there are more IE-related problems. See the Browser implementation tables.
如果不查看该网站,很难判断问题出在哪里。您介意在这里发布一个链接吗?
另外,您确定“icon.png”与您的页面位于同一目录中,并且可以通过浏览器查看吗?
It's hard to tell what the problem could be without seeing the site. Would you mind posting a link to it here?
Also, are you sure that 'icon.png' exists in the same directory as your page, and is viewable through the browser?